Ticket UUID: | 2186888 | |||
Title: | infinite for-loop in Tcl 8.6a3 | |||
Type: | Bug | Version: | obsolete: 8.6a3 | |
Submitter: | jroemmler | Created on: | 2008-10-22 13:56:26 | |
Subsystem: | 47. Bytecode Compiler | Assigned To: | msofer | |
Priority: | 8 | Severity: | ||
Status: | Closed | Last Modified: | 2008-11-17 15:12:56 | |
Resolution: | Fixed | Closed By: | ferrieux | |
Closed on: | 2008-11-17 08:12:56 | |||
Description: |
The following small Tcl code loops forever in Tcl8.6a3: for {set i 20} {$i > 0} {incr i -1} { puts "i=$i" continue } But only, if source'd ! It runs OK if entered interactively. I know the example is bogus, but it has been stripped down as much as possible. My configuration is (RHEL4 machine): # uname -a Linux orion 2.6.9-42.ELsmp #1 SMP Wed Jul 12 23:32:02 EDT 2006 x86_64 x86_64 x86_64 GNU/Linux Tcl configured with: # cd tcl8.6a3/unix # ./configure --enable-64bit \ --prefix=/usr/local/tcltk8.6a3 \ --enable-symbols My memory debugger (purify) doesn't complain. I can create a stack trace if required. -Jochen | |||
User Comments: |
ferrieux added on 2008-11-17 15:12:55:
Committed, closing. ferrieux added on 2008-11-17 14:42:31: File Added - 301742: fortest.patch Attaching missing test. File Added: fortest.patch dgp added on 2008-10-23 21:50:12: Alpha testing works! Spread the word! jroemmler added on 2008-10-23 15:26:13: I can also confirm that the suggested patch fixes my problem. Thank you very much for the quick turnaround guys. Good job! Jochen msofer added on 2008-10-23 10:30:30: Patch reviewed, accepted, committed. Leaving open as reminder: missing test! dgp added on 2008-10-23 01:24:18: I believe this patch is the fix. Miguel should review and commit. Original reporter is invited to test as well. diff -u -r1.107 tclCmdAH.c --- generic/tclCmdAH.c 17 Oct 2008 16:32:58 -0000 1.107 +++ generic/tclCmdAH.c 22 Oct 2008 18:22:57 -0000 @@ -1763,7 +1763,7 @@ char *msg = data[3]; - if (result == TCL_OK) { + if ((result == TCL_OK) || (result == TCL_CONTINUE)) { /* * TIP #280. Make invoking context available to next script. * dgp added on 2008-10-23 01:08:12: sorry, it's the *non*compiled [for] that is at fault. Given the timing of the appearance, seems to be a flaw in the new TclNRForObjCmd(), probably related to handling TCL_CONTINUE from the body. dgp added on 2008-10-23 00:47:41: NR-enabling [for] on 2008-07-31 appears to be to blame. dgp added on 2008-10-22 22:55:36: 8.6a1 is ok. Compiled [for] appears to be at fault. dgp added on 2008-10-22 22:49:19: confirmed. Also in 8.6a2. jroemmler added on 2008-10-22 20:56:26: File Added - 298399: loop.tcl |