Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2001-08-07
22:50 • Closed ticket [439843ffff]: crash when getting the return value of b plus 7 ... artifact: 1be06407df user: msofer
06:17 • Ticket [439843ffff]: 5 changes artifact: cf25cbd719 user: hobbs
2001-07-10
19:30 • Ticket [439843ffff]: 5 changes artifact: 946684d463 user: msofer
19:28 • Ticket [439843ffff]: 4 changes artifact: 4cc1c32350 user: msofer
15:42 • Ticket [439843ffff]: 6 changes artifact: 7f54f71b5d user: dkf
2001-07-09
21:03 • New ticket [439843ffff]. artifact: b28b6bce1b user: jstrot

crash when getting the return value of b

Closed / Fixed439843ffffffffffffffffffffffffffffffffffCreated 25 years agoUpdated 25 years ago
Descriptionplain2001-07-09 21:03:18
Tcl Version: ActiveTcl v8.3.3

OS: Windows 2000 Pro SP2

Problem Behaviour:

The following code causes a crash:

namespace eval ::crashTcl {
  while {1} {
    set b [break]
  }
}

I know it doesn't make sense to take the return value 
of break... This is the simplified version of one of 
my scripts that calls a procedure (instead of break) 
which could return a value or force a break (return -
code break) It doesn't happen if the whole thing is 
not with a namespace eval.

this piece of code crashes with:

TclExecuteByteCode: done instruction at pc 14: stack 
top 0 != entry stack top -1 TclExecuteByteCode 
execution failure: end stack top != start stack top

Expected Behaviour:
b should not be assigned any value
break should work as expected, breaking out of the 
while
dkfplain2001-07-10 15:42:29
Logged In: YES 
user_id=79902

I think this is a duplicate of a known problem...
msoferplain2001-07-10 19:28:12
Logged In: YES 
user_id=148712

This is indeed the same as [Bug 406709], which is already
solved in current sources (Tcl8.4a3). 

The fix didn't make it in time for 8.3.3. You can avoid the
crash and obtain your desired behaviour by bypassing the
bytecode engine via [eval]:

  namespace eval ::thisWillNotCrashTcl { 
      set cmd [list while {1} {set b [break]}]
      eval $cmd
  }

'cmd' can also be safely be defined as a string instead of a
list.
msoferplain2001-07-10 19:30:22
Logged In: YES 
user_id=148712

I'm leaving the bug open and assigning it to the 8.3.3
release manager - should this be fixed in the 8.3.3 branch?
hobbsplain2001-08-07 06:17:21
Logged In: YES 
user_id=72656

Miguel, please apply to core-8-3-1-branch as well.
msoferplain2001-08-07 22:50:26
Logged In: YES 
user_id=148712

Patch #414470 applied to core-8-3-1-branch.
Log in (anonymous is fine) to add a comment.