Tcl Source Code

View Ticket
Login
Ticket UUID: 2946129
Title: Wrong frame in bytecode
Type: Bug Version: obsolete: 8.5.5
Submitter: eugene_cdn Created on: 2010-02-04 19:56:37
Subsystem: 47. Bytecode Compiler Assigned To: msofer
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2010-02-06 10:41:15
Resolution: Duplicate Closed By: msofer
    Closed on: 2010-02-06 03:41:15
Description:
Tcl version: 8.5.5.
OS: Linux RedHat 5 & Solaris 10

Compilation of a script with active Async handler and non-trivial script executed by Async handler may cause generating bytecode with wrong variable frame. In attached example, compilation of "if" statement with constants in a regular procedure will call Tcl_AsyncInvoke.  Then compilation of subsequent procedures called by Async will be in unpredictable frame: main body will be compiled in right frame but body of switch will be compiled in the frame of original synchronous procedure. You will see an error:
    can't read "abc(xyz)": variable isn't array.
User Comments: msofer added on 2010-02-06 10:41:15:

allow_comments - 1

msofer added on 2010-02-06 10:41:14:
Turns out this was a different symptom of [Bug 2802881]

msofer added on 2010-02-06 00:40:29:
Whatever the bug, it is already fixed in the current bugfix release.

I strongly recommend using the current bugfix release instead. Maintaining you own patched version of an older version sounds suboptimal.

 In order to prepare a custom patch you will need to hunt down the fix in the Changelog and cvs entries.

eugene_cdn added on 2010-02-06 00:34:32:
I tested it with Tcl 8.5.8. It works fine. It also work with Tcl 8.4. We cannot switch to another Tcl version because of release schedule. We need to patch current version of Tcl, 8.5.8.
Original testcase may be simplified by replacing pack with puts to not confuse people. It does not reach to the execution of pack if there is a bug in byte compilation. Sorry for confusion.

msofer added on 2010-02-06 00:28:15:

allow_comments - 0

msofer added on 2010-02-05 20:44:03:

allow_comments - 1

Several remarks:

1. please test with a current release (8.5.8)

2. this has most probably nothing to do with the BC compiler, it would rather be a problem with the current CallFrame

3. the comments seem not to refer to the attached files:
   - original comment talks about variable abc(xyz): no such thing in the attachment
   - second comment suggests running this in tclsh; the code does not package require Tk and uses [pack]

Please resubmit with an accurate description of the problem. It would also help if there is a description of what is supposed to be happening with this code, both the .c and .tcl parts

eugene_cdn added on 2010-02-05 03:03:09:
Added a testcase. To reproduce:
 - modify paths in ./build
 - ./build
 - tclsh byte.tcl
You will see "variable isn't array" error.

eugene_cdn added on 2010-02-05 03:00:52:

File Added - 361672: 2946129.tgz

Attachments: