Tcl Source Code

Artifact [a7689b2eba]
Login

Artifact a7689b2ebaaaee8f3650bceae1c31c2f55a9e89d:

Attachment "patch" to ticket [414470ffff] added by msofer 2001-04-07 10:12:35. Also attachment "patch" to ticket [406709ffff] added by msofer 2001-04-07 10:07:41.
Index: tclExecute.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclExecute.c,v
retrieving revision 1.20
diff -c -r1.20 tclExecute.c
*** tclExecute.c	2001/03/13 09:31:37	1.20
--- tclExecute.c	2001/04/07 03:03:25
***************
*** 635,645 ****
  	    Tcl_SetObjResult(interp, valuePtr);
  	    TclDecrRefCount(valuePtr);
  	    if (stackTop != initStackTop) {
! 		fprintf(stderr, "\nTclExecuteByteCode: done instruction at pc %u: stack top %d != entry stack top %d\n",
  			(unsigned int)(pc - codePtr->codeStart),
  			(unsigned int) stackTop,
  			(unsigned int) initStackTop);
! 		panic("TclExecuteByteCode execution failure: end stack top != start stack top");
  	    }
  	    TRACE_WITH_OBJ(("=> return code=%d, result=", result),
  		    iPtr->objResultPtr);
--- 635,649 ----
  	    Tcl_SetObjResult(interp, valuePtr);
  	    TclDecrRefCount(valuePtr);
  	    if (stackTop != initStackTop) {
! 		/*
! 		 * if extra items in the stack, clean up the stack before return
! 		 */
! 		if (stackTop > initStackTop) goto abnormalReturn;
! 		fprintf(stderr, "\nTclExecuteByteCode: done instruction at pc %u: stack top %d < entry stack top %d\n",
  			(unsigned int)(pc - codePtr->codeStart),
  			(unsigned int) stackTop,
  			(unsigned int) initStackTop);
! 		panic("TclExecuteByteCode execution failure: end stack top < start stack top");
  	    }
  	    TRACE_WITH_OBJ(("=> return code=%d, result=", result),
  		    iPtr->objResultPtr);
Index: foreach.test
===================================================================
RCS file: /cvsroot/tcl/tcl/tests/foreach.test,v
retrieving revision 1.6
diff -c -r1.6 foreach.test
*** foreach.test	2000/04/10 17:18:59	1.6
--- foreach.test	2001/04/07 03:02:26
***************
*** 210,215 ****
--- 210,224 ----
      catch {break foo} msg
      set msg
  } {wrong # args: should be "break"}
+ # Check for bug #406709 
+ test foreach-5.5 {break tests} {
+     proc a {} {
+ 	set a 1
+ 	foreach b b {list [concat a; break]; incr a}
+ 	incr a
+     }
+     a
+ } {2}
  
  # Test for incorrect "double evaluation" semantics