Skip to content
Tcl Source Code Artifact [950f8ee69d]
Login

Artifact [950f8ee69d]

Artifact 950f8ee69d111d3b4f329e38143bf1b3ba5e342b:

Ticket change [950f8ee69d] - New ticket [2017857fffffffff|2017857fff] <i>NRE crash calling tailcall from uplevel context</i>. by tallniel on 2008-07-14 10:33:23.
D 2008-07-14T10:33:23
J assignee msofer
J cmimetype text/plain
J comment I'm\sseeing\sa\scrash\stesting\sNRE\stailcall\son\sWindows\sXP,\susing\sa\stclsh86sg\sbuilt\sfrom\scurrent\sCVS\shead\s(VS.NET\s2003,\sstatic,\ssymbols).\sCurrently\strying\sto\strack\sdown\sthe\sproblem,\spossibly\sa\sfunny\sinteraction\sbetween\s[uplevel]\sand\s[tailcall].\sI'll\stry\sand\screate\sa\sminimal\sexample.\sIn\sthe\smeantime,\sthe\scode\sthat\scauses\sthe\scrash\sis\shttp://wiki.tcl.tk/16695.\sCopy\sthat\scode\sto\san\seditor,\sand\sthen\sadd\sthe\sfollowing\sinterp\salias\sat\sthe\stop:\n\n\sinterp\salias\s{}\stailcall\s{}\s::tcl::unsupported::tailcall\n\nThen\schange\sthe\sterm::fold\sprocedure\sto\suse\s[tailcall]:\n\n\sproc\sterm::fold\s{f\sz\st}\s{\n\s\s\s\smatch\s$t\s{\n{Lambda\svar\sbody}\s\s\s->\s{\stailcall\s$f\slam\s$z\s$var\s$body\s}\n{Apply\sa\sb}\s\s\s\s->\s{\stailcall\s$f\sapp\s$z\s[fold\s$f\s$z\s$a]\s[fold\s$f\s$z\s$b]\s}\n{Var\sname}\s\s\s\s->\s{\stailcall\s$f\svar\s$z\s$name\s}\n{IntLit\si}\s\s\s\s->\s{\stailcall\s$f\sint\s$z\s$i\s}\n{Add\sa\sb}\s\s\s\s->\s{\stailcall\s$f\sadd\s$z\s[fold\s$f\s$z\s$a]\s[fold\s$f\s$z\s$b]\s}\n{Sub\sa\sb}\s\s\s\s->\s{\stailcall\s$f\ssub\s$z\s[fold\s$f\s$z\s$a]\s[fold\s$f\s$z\s$b]\s}\n{Mul\sa\sb}\s\s\s\s->\s{\stailcall\s$f\smul\s$z\s[fold\s$f\s$z\s$a]\s[fold\s$f\s$z\s$b]\s}\n{Div\sa\sb}\s\s\s\s->\s{\stailcall\s$f\sdiv\s$z\s[fold\s$f\s$z\s$a]\s[fold\s$f\s$z\s$b]\s}\n\s\s\s\s}\n\s}\n\nThis\sis\san\sinteresting\scase,\sas\s[match]\suses\sboth\s[uplevel]\sand\s[dict\swith],\sso\splenty\sof\stricksiness\sgoing\son\shere.\sPossibly\smight\snot\sbe\sok\sto\scall\s[tailcall]\shere,\sbut\sshould\sproduce\san\serror\srather\sthan\sa\scrash.\sCrash\sseems\sto\sbe\san\sinvalid\spointer\sderef\s(cannot\saccess\slocation\s0x00000014).\sStack\sdump:\n\n>tclsh86sg.exe!TclExecuteByteCode(Tcl_Interp\s*\sinterp=0x00afa8b8,\sByteCode\s*\scodePtr=0x00b86ae0)\s\sLine\s2741\s+\s0xcC\n\stclsh86sg.exe!NRPostProcess(Tcl_Interp\s*\sinterp=0x00afa8b8,\sint\sresult=0,\sint\sobjc=0,\sTcl_Obj\s*\sconst\s*\sobjv=0x00000000)\s\sLine\s7419\s+\s0x10C\n\stclsh86sg.exe!TclEvalObjEx(Tcl_Interp\s*\sinterp=0x00afa8b8,\sTcl_Obj\s*\sobjPtr=0x00b5e5e8,\sint\sflags=0,\sconst\sCmdFrame\s*\sinvoker=0x00afb314,\sint\sword=1)\s\sLine\s5327\s+\s0x11C\n\stclsh86sg.exe!Tcl_CatchObjCmd(void\s*\sdummy=0x00000000,\sTcl_Interp\s*\sinterp=0x00afa8b8,\sint\sobjc=3,\sTcl_Obj\s*\sconst\s*\sobjv=0x00afb33c)\s\sLine\s253\s+\s0x1eC\n\stclsh86sg.exe!Tcl_EvalObjv(Tcl_Interp\s*\sinterp=0x00afa8b8,\sint\sobjc=3,\sTcl_Obj\s*\sconst\s*\sobjv=0x00afb33c,\sint\sflags=2097152)\s\sLine\s4079\s+\s0x15C\n\stclsh86sg.exe!TclExecuteByteCode(Tcl_Interp\s*\sinterp=0x00afa8b8,\sByteCode\s*\scodePtr=0x00b67840)\s\sLine\s2696\s+\s0x1cC\n\stclsh86sg.exe!NRPostProcess(Tcl_Interp\s*\sinterp=0x00afa8b8,\sint\sresult=0,\sint\sobjc=0,\sTcl_Obj\s*\sconst\s*\sobjv=0x00000000)\s\sLine\s7419\s+\s0x10C\n\stclsh86sg.exe!TclEvalObjEx(Tcl_Interp\s*\sinterp=0x00afa8b8,\sTcl_Obj\s*\sobjPtr=0x00b862d0,\sint\sflags=0,\sconst\sCmdFrame\s*\sinvoker=0x00afb1c0,\sint\sword=2)\s\sLine\s5327\s+\s0x11C\n\stclsh86sg.exe!Tcl_WhileObjCmd(void\s*\sdummy=0x00000000,\sTcl_Interp\s*\sinterp=0x00afa8b8,\sint\sobjc=3,\sTcl_Obj\s*\sconst\s*\sobjv=0x00afb1f0)\s\sLine\s4029\s+\s0x1eC\n\stclsh86sg.exe!Tcl_EvalObjv(Tcl_Interp\s*\sinterp=0x00afa8b8,\sint\sobjc=3,\sTcl_Obj\s*\sconst\s*\sobjv=0x00afb1f0,\sint\sflags=2097152)\s\sLine\s4079\s+\s0x15C\n\stclsh86sg.exe!TclEvalEx(Tcl_Interp\s*\sinterp=0x00afa8b8,\sconst\schar\s*\sscript=0x00b81ec8,\sint\snumBytes=6872,\sint\sflags=0,\sint\sline=219)\s\sLine\s5044\s+\s0x16C\n\stclsh86sg.exe!Tcl_EvalEx(Tcl_Interp\s*\sinterp=0x00afa8b8,\sconst\schar\s*\sscript=0x00b81ec8,\sint\snumBytes=6872,\sint\sflags=0)\s\sLine\s4751\s+\s0x17C\n\stclsh86sg.exe!Tcl_FSEvalFileEx(Tcl_Interp\s*\sinterp=0x00afa8b8,\sTcl_Obj\s*\spathPtr=0x00b69f28,\sconst\schar\s*\sencodingName=0x00000000)\s\sLine\s1776\s+\s0x13C\n\stclsh86sg.exe!Tcl_Main(int\sargc=-1,\schar\s*\s*\sargv=0x00af38e8,\sint\s(Tcl_Interp\s*)*\sappInitProc=0x00401070)\s\sLine\s443\s+\s0x11C\n\stclsh86sg.exe!main(int\sargc=2,\schar\s*\s*\sargv=0x00af38e0)\s\sLine\s102\s+\s0x12C\n\stclsh86sg.exe!mainCRTStartup()\s\sLine\s259\s+\s0x19C\n\skernel32.dll!7c816fd7()\s\n\nOffending\sline\sin\stclExecute.c:\n\s\s\s\siPtr->cmdFramePtr\s=\siPtr->cmdFramePtr->nextPtr;\n\nI\scan't\sdig\sinto\sthat\sstructure\sto\ssee\swhat\sthose\sfields\sare\sset\sto\sas\siPtr\sis\sjust\sa\s#define,\sand\sthe\sinterp\spointer\sshows\snothing\sinteresting.\sLooks\slike\siPtr->cmdFramePtr\sis\sinvalid\sat\sthis\spoint.
J foundin obsolete:\s8.6a1
J is_private 0
J priority 5\sMedium
J resolution None
J status Open
J submitter tallniel
J subsystem 45.\sParsing\sand\sEval
J title NRE\scrash\scalling\stailcall\sfrom\suplevel\scontext
J type Bug
K 2017857fffffffffffffffffffffffffffffffff
U tallniel
Z f5f36e992dfc55b0e1513baa393c78d3