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.