diff options
-rw-r--r-- | ChangeLog | 16 | ||||
-rw-r--r-- | generic/tclCompCmds.c | 3 | ||||
-rw-r--r-- | tests/dict.test | 51 |
3 files changed, 64 insertions, 6 deletions
@@ -1,12 +1,18 @@ +2012-02-15 Donal K. Fellows <dkf@users.sf.net> + + * generic/tclCompCmds.c (TclCompileDictForCmd): [Bug 3487626]: Fix + crash in compilation of [dict for] when its implementation command is + used directly rather than through the ensemble. + 2012-02-09 Don Porter <dgp@users.sourceforge.net> - * generic/tclStringObj.c: [Bug 3484402] Correct Off-By-One + * generic/tclStringObj.c: [Bug 3484402]: Correct Off-By-One error appending unicode. Thanks to Poor Yorick. Also corrected test - for when growth is needed. + for when growth is needed. 2012-02-06 Don Porter <dgp@users.sourceforge.net> - * generic/tclCompCmds.c: [Bug 3485022] TclCompileEnsemble() avoid + * generic/tclCompCmds.c: [Bug 3485022]: TclCompileEnsemble() avoid * tests/trace.test: compile when exec traces set. 2012-02-06 Miguel Sofer <msofer@users.sf.net> @@ -14,10 +20,10 @@ * generic/tclTrace.c: Fix for [Bug 3484621]: insure that * tests/trace.test: execution traces on bytecoded commands bump the interp's compile epoch. - + 2012-02-02 Jan Nijtmans <nijtmans@users.sf.net> - * generic/tclUniData.c: [Frq 3464401] Support Unicode 6.1 + * generic/tclUniData.c: [FRQ 3464401]: Support Unicode 6.1 * generic/regc_locale.c: 2012-02-02 Don Porter <dgp@users.sourceforge.net> diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 1f8bd21..9eb74f5 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -972,7 +972,7 @@ TclCompileDictForCmd( * Compile the loop body itself. It should be stack-neutral. */ - SetLineInformation (4); + SetLineInformation(3); CompileBody(envPtr, bodyTokenPtr, interp); TclEmitOpcode( INST_POP, envPtr); @@ -1172,6 +1172,7 @@ TclCompileDictUpdateCmd( TclEmitInstInt4( INST_BEGIN_CATCH4, range, envPtr); ExceptionRangeStarts(envPtr, range); + SetLineInformation(parsePtr->numWords - 1); CompileBody(envPtr, bodyTokenPtr, interp); ExceptionRangeEnds(envPtr, range); diff --git a/tests/dict.test b/tests/dict.test index 5821c32..b92893e 100644 --- a/tests/dict.test +++ b/tests/dict.test @@ -1194,6 +1194,57 @@ test dict-22.11 {dict with command: no recursive structures [Bug 1786481]} { string range [append foo OK] end-1 end } OK +proc linenumber {} { + dict get [info frame -1] line +} +test dict-23.1 {dict compilation crash: Bug 3487626} { + apply {n { + set e {} + set k {} + dict for {a b} {c {d {e {f g}}}} { + ::tcl::dict::for {h i} $b { + dict update i e j { + ::tcl::dict::update j f k { + return [expr {$n - [linenumber]}] + } + } + } + } + }} [linenumber] +} 5 +test dict-23.2 {dict compilation crash: Bug 3487626} knownBug { + # Something isn't quite right in line number and continuation line + # tracking; at time of writing, this test produces 7, not 5, which + # indicates that the extra newlines in the non-script argument are + # confusing things. + apply {n { + set e {} + set k {} + dict for {a { +b +}} {c {d {e {f g}}}} { + ::tcl::dict::for {h { +i +}} ${ +b +} { + dict update { +i +} e { +j +} { + ::tcl::dict::update { +j +} f k { + return [expr {$n - [linenumber]}] + } + } + } + } + }} [linenumber] +} 5 +rename linenumber {} + # cleanup ::tcltest::cleanupTests return |