| Ticket UUID: | 1382528 | ||
| Title: | dict for {k v} $emptyDict crashes | ||
| Type: | Bug | Created on: | 2005-12-16 15:55:16 |
| Submitter: | a_kovalenko | Assigned to: | dkf |
| Subsystem: | 47. Bytecode Compiler | Severity: | |
| Priority: | 9 Immediate | Last modified: | 2005-12-19 05:42:40 |
| Status: | Closed | Closed by: | dkf |
| Resolution: | Fixed | Closed on: | 2005-12-18 22:42:40 |
| Version: | obsolete: 8.5a4 | ||
| Description: | ||||
Test case:
proc bad {} {
dict for {k v} {} {}
catch {whoops}
}
bad
causes segfault (linux), access violation (windows).
The crash itself appears in TclStackFree (when
decrementing refcount), but seems to be related with
Tcl_DictObjFirst / Tcl_DictObjDone behavior with empty
values.
| ||||
| User Comments: | ||||
dkf added on 2005-12-16 23:00:15:
Logged In: YES user_id=79902 Only happens in compiled [dict for]. a_kovalenko added on 2005-12-16 23:48:18:
Logged In: YES user_id=241496 I know. The problem is in exception ranges: beginCatch bytecode is not reached with empty dicts, but endCatch is. a_kovalenko added on 2005-12-16 23:58:54:
Logged In: YES user_id=241496 The patch solving this problem is attached. beginCatch is now emitted before the first JumpTrue. a_kovalenko added on 2005-12-16 23:58:55:
File Added - 160100: dict-for.patch dkf added on 2005-12-19 05:42:40:
Logged In: YES user_id=79902 I'm not going with that because it is likely to inhibit future bytecode optimizations. Instead, I've split the code so that the handling of loop-exit is different from the handling of loop-never-entered. This is a few instructions longer, but probably faster. BTW, thanks for spotting that it was a problem with the management of the catch stack; I was stumped! | ||||
Attachments:
- dict-for.patch [download] added by a_kovalenko on 2005-12-16 23:58:55. [details]
