Overview
| Artifact ID: | 8a0b5684543cf12fd19b5e5118194c884475718a29f1082ee9b0630161703c63 |
|---|---|
| Ticket: | a8579d906a28127d541ba23f7c1223259f97b123
'argument with no name' calling proc with args built in different frame |
| User & Date: | russell-tcl on 2021-10-06 21:57:42 |
Changes
- assignee changed to: "nobody"
- closer changed to: "nobody"
- cmimetype changed to: "text/plain"
- comment changed to:
The bug will probably not show up if the args list is constructed in a single frame. The code below uses an external proc to create each arg which are then lappended to the final list used, with or without a default value. The first version of tcl where this shows up is 8.6.9, when the trampoline code started to be used. I've tested every released version of tcl since, compiling from source. The error occurs in 8.6.9,10,11 8.7a5 and 9.0a3. The error does not occur in 8.6.8,7,6,5 8.5.19 or 8.4.20. The main platform is Ubuntu: uname -a 5.11.0-37-generic #41-Ubuntu SMP x86_64 x86_64 x86_64 GNU/Linux I tried following the process with gdb/VS Code and in working and non-working versions, the objv bytes is 0x0 when the proc commands starts. Here's what makes the bug go away: In the helper proc or in the main proc call: llength $argName on each arg. In the main proc: puts $argsList If you catch the error with proc, you can still make the bug go away using the above calls. If you just repeat the same call the bug is still there. I have not found a way to repeat the bug without a helper proc. Here's the simplified code which shows the bug: proc splitArg {argSpec {splitChar !} {ArrayName ""}} { set firstPart [lindex $argSpec 0] set first [string first $splitChar $firstPart] if {$first > -1} { set argName [string range $firstPart 0 [expr {$first - 1}]] set extra [string range $firstPart [expr {$first + 1}] end] } if {$ArrayName eq ""} { set ArrayName $argName } upvar $ArrayName ArgNameArray array set ArgNameArray [lindex $argSpec 1] return $argName } proc testProc {procName argSpecs body} { set argList [list] foreach argSpec $argSpecs { if {[array exists specArray]} { array unset specArray } set argName [splitArg $argSpec ! specArray] if {[info exists specArray(default)]} { lappend argList [list $argName $specArray(default)] } else { lappend argList [list $argName] } } proc $procName $argList $body } testProc myproc {{arg1!type1 {default "It Works, no bug in "}}}\ {puts -nonewline $arg1;puts tcl[info patchlevel]} myproc - foundin changed to: "tcl8.6.9+"
- is_private changed to: "0"
- login: "russell-tcl"
- priority changed to: "5 Medium"
- private_contact changed to: "746f77a74dfbfc2cb5ae42088bf5906fdc297916"
- resolution changed to: "None"
- severity changed to: "Important"
- status changed to: "Open"
- submitter changed to: "russell-tcl"
- subsystem changed to: "18. Commands M-Z"
- title changed to:
'argument with no name' calling proc with args built in different frame
- type changed to: "Bug"