Tcl Source Code

Check-in [3a3f75ac5a]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Stop segfault due to OBOE in CompileWord() calls in [dict incr] compiler.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | core-8-5-branch
Files: files | file ages | folders
SHA1: 3a3f75ac5a6d5f72a2981ea345abd21beaced025
User & Date: dgp 2013-09-19 14:06:46
Context
2013-09-19
14:48
Line numbers wrong in compiled [dict get]. check-in: 1b79ee628e user: dgp tags: core-8-5-branch
14:22
Stop segfault due to OBOE in CompileWord() calls in [dict incr] compiler. check-in: 109b343727 user: dgp tags: trunk
14:06
Stop segfault due to OBOE in CompileWord() calls in [dict incr] compiler. check-in: 3a3f75ac5a user: dgp tags: core-8-5-branch
13:06
Line numbers wrong in compiled [dict set]. check-in: a5c2d783ad user: dgp tags: core-8-5-branch
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tclCompCmds.c.

802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
    }
    dictVarIndex = TclFindCompiledLocal(name, nameChars, 1, procPtr);

    /*
     * Emit the key and the code to actually do the increment.
     */

    CompileWord(envPtr, keyTokenPtr, interp, 3);
    TclEmitInstInt4( INST_DICT_INCR_IMM, incrAmount,	envPtr);
    TclEmitInt4(     dictVarIndex,			envPtr);
    return TCL_OK;
}

int
TclCompileDictGetCmd(







|







802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
    }
    dictVarIndex = TclFindCompiledLocal(name, nameChars, 1, procPtr);

    /*
     * Emit the key and the code to actually do the increment.
     */

    CompileWord(envPtr, keyTokenPtr, interp, 2);
    TclEmitInstInt4( INST_DICT_INCR_IMM, incrAmount,	envPtr);
    TclEmitInt4(     dictVarIndex,			envPtr);
    return TCL_OK;
}

int
TclCompileDictGetCmd(

Changes to tests/dict.test.

1250
1251
1252
1253
1254
1255
1256





1257
1258
1259
1260
1261
1262
1263
} {bar baz}
test dict-23.4 {CompileWord OBOE} {
    apply {n {
	dict set foo {*}{
	} [return [incr n -[linenumber]]] val
    }} [linenumber]
} 1






rename linenumber {}

# cleanup
::tcltest::cleanupTests
return








>
>
>
>
>







1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
} {bar baz}
test dict-23.4 {CompileWord OBOE} {
    apply {n {
	dict set foo {*}{
	} [return [incr n -[linenumber]]] val
    }} [linenumber]
} 1
test dict-23.5 {CompileWord OBOE} {
    # segfault when buggy
    apply {{} {tcl::dict::incr foo \
	[format bar]}}
} {bar 1}

rename linenumber {}

# cleanup
::tcltest::cleanupTests
return