Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2007-03-16
08:54 • Closed ticket [978574ffff]: segfault in stack.test with mingw gcc plus 7 oth... artifact: db48397712 user: mdejong
2005-07-24
10:01 • Ticket [978574ffff]: 4 changes artifact: cda532e494 user: mdejong
2004-11-23
05:34 • Ticket [978574ffff]: 4 changes artifact: c4ec9ab40d user: mdejong
2004-07-15
02:34 • Ticket [978574ffff]: 4 changes artifact: e36879423d user: msofer
02:14 • Ticket [978574ffff]: 6 changes artifact: 12aea1a161 user: hobbs
2004-06-24
05:42 • Ticket [978574ffff]: 4 changes artifact: d1b89caba8 user: patthoyts
2004-06-23
22:25 • New ticket [978574ffff]. artifact: 599fb781e8 user: patthoyts

segfault in stack.test with mingw gcc

Closed / Out of Date978574ffffffffffffffffffffffffffffffffffCreated 22 years agoUpdated 20 years ago
Descriptionplain2004-06-23 22:25:57
Using Mingw gcc 3.2 (mingw special 20020817-1) on
Windows XP I reliably get a segfault in stack-3.1. This
only seems to occur for this compiler (MSVC is OK on
the same platform) and it requires -O in the CFLAGS.

Also for another user (steve redler) with gcc version
3.2.3 (mingw special 20030504-1) also on WinXP.

I got the following stack trace (part of):
(gdb) where 10
#0  0x1008cc63 in probe ()
#1  0x011a8cf8 in ?? ()
#2  0x1000dc97 in TclInterpReady (interp=0x3d5980)
    at ../generic/tclBasic.c:2983
#3  0x10035f3a in TclCompEvalObj (interp=0x3d5980,
objPtr=0xabfa08)
    at ../generic/tclExecute.c:923
#4  0x1006b47a in TclObjInterpProc
(clientData=0x11ef0c0, interp=0x3d5980, 
    objc=2, objv=0x11a8cf8) at ../generic/tclProc.c:1088

At level #2 we are called from 
2983        if (((iPtr->numLevels) > iPtr->maxNestingDepth)
where it seems iPtr is NULL
patthoytsplain2004-06-24 05:42:06
Logged In: YES 
user_id=202636

More info - it seems that in the offending function we have:
2952    TclInterpReady(interp)
2953        Tcl_Interp *interp;
2954    {
2955        register Interp *iPtr = (Interp *) interp;

But for me interp is valid while iPtr is 0x0. !?!
Optimisation bug?
I may add that we don't seem to be all that far in:
(gdb) print ((Interp *)interp)->numLevels
$11 = 1312
(gdb) print ((Interp *)interp)->maxNestingDepth
$12 = 10000
hobbsplain2004-07-15 02:14:10
Logged In: YES 
user_id=72656

Isn't this an issue that the stack depth check isn't
operating correctly for those compilers?  Make sure that
tclWin32Dll.c:TclpCheckStackSpace is correct when not using
MSVC.  That is Mo's code, IIRC.
msoferplain2004-07-15 02:34:05
Logged In: YES 
user_id=148712

Stack corruption is a very likely outcome if the stack depth
check is not working. In this sense, iPtr==0x0!=interp is
not so surprising.

Note also that stack-3.1 will definitely cause a segfault if
TclpCheckStackDepth is non-functional.
mdejongplain2004-11-23 05:34:14
Logged In: YES 
user_id=90858

I have run the tests over and over again on my Windows XP box
with a mingw compiled version of Tcl and I am not seeing the
problem you describe here. Are you seeing this every time, or
does it only happen once in a blue moon?
mdejongplain2005-07-24 10:01:38
Logged In: YES 
user_id=90858

Has this problem been fixed in the CVS HEAD or the Tcl 8 .4.11
release? There were some mingw related changes, so this is
likely
fixed now. Please advise.
mdejongplain2007-03-16 08:54:47
Logged In: YES 
user_id=90858
Originator: NO

I am closing this bug since I can't reproduce it and
I have tested it many times on an XP box.
Log in (anonymous is fine) to add a comment.