Overview
| Artifact ID: | 011b788c69b9e777125340f2209a7b8e34759137 |
|---|---|
| Ticket: | 483611ffffffffffffffffffffffffffffffffff
codePtr->maxStackDepth badly computed |
| User & Date: | msofer on 2001-11-21 00:08:20 |
Changes
- icomment:
Logged In: YES user_id=148712 Two nice examples of bad computations of the tcl stack depth in expressions - straight from the testsuite. Compiling with TCL_TRACE_COMPILE and setting tcl_traceCompile to 2, we see: Ex 1: reported depth 2, used depth 5 ByteCode 0x814bb18, refCt 1, epoch 0, interp 0x8120028 (epoch 0) Source "expr {pow(2.1, 27.5-(24.4*(5%2)))}\n" Cmds 1, src 35, inst 16, litObjs 5, aux 0, stkDepth 2, code/src 4.11 Code 144 = header 100+inst 16+litObj 20+exc 0+aux 0+cmdMap 4 Commands 1: 1: pc 0-14, src 0-33 Command 1: "expr {pow(2.1, 27.5-(24.4*(5%2)))}" (0) push1 0 # "2.1" (2) push1 1 # "27.5" (4) push1 2 # "24.4" (6) push1 3 # "5" (8) push1 4 # "2" (10) mod (11) mult (12) sub (13) callBuiltinFunc1 13 (15) done Ex 2: reported depth 2, used depth 7 ByteCode 0x81553f8, refCt 1, epoch 0, interp 0x8120028 (epoch 0) Source "expr 2 + 3 +\n" Cmds 1, src 13, inst 18, litObjs 4, aux 0, stkDepth 2, code/src 11.08 Code 144 = header 100+inst 18+litObj 16+exc 0+aux 0+cmdMap 4 Commands 1: 1: pc 0-16, src 0-11 Command 1: "expr 2 + 3 +" (0) push1 0 # "2" (2) push1 1 # " " (4) push1 2 # "+" (6) push1 1 # " " (8) push1 3 # "3" (10) push1 1 # " " (12) push1 2 # "+" (14) concat1 7 (16) exprStk (17) done A fix for example 2 follows soon; it does *not* fix example 1, which shows that the problem may be quite general. It is present since Tcl8.0 - login: "msofer"
- mimetype: "text/plain"
- username: "msofer"