Overview
| Artifact ID: | 27b91fb5a2cce960c0e3ce11df9a87e3169b7ed8cea797602aaff9eb90793fe7 |
|---|---|
| Ticket: | 57bfcf43dd4bd6c2257c1063fc079d56ca169191
Remove unreachable code in Tcl_SetWideIntObj() |
| User & Date: | chrstphrchvz on 2023-03-05 18:55:22 |
Changes
- assignee changed to: "nobody"
- closer changed to: "nobody"
- cmimetype changed to: "text/x-fossil-wiki"
- comment changed to:
In <tt>Tcl_SetWideIntObj()</tt> (generic/tclObj.c): <pre> if ((wideValue >= (Tcl_WideInt) LONG_MIN) && (wideValue <= (Tcl_WideInt) LONG_MAX)) { TclSetLongObj(objPtr, (long) wideValue); } else { #ifndef TCL_WIDE_INT_IS_LONG TclSetWideIntObj(objPtr, wideValue); <span style="color:firebrick">#else mp_int big;<br /> TclBNInitBignumFromWideInt(&big, wideValue); Tcl_SetBignumObj(objPtr, &big);</span> #endif } </pre> The section creating a bignum is only defined when <tt>Tcl_WideInt</tt> is <tt>long</tt>. But when <tt>Tcl_WideInt</tt> is <tt>long</tt>, the range check is always true: <tt>TclSetLongObj()</tt> is always called, and the bignum section is never used. I am not aware of any other similar examples of this in core Tcl. - foundin changed to: "8.5.19, 8.6.13"
- is_private changed to: "0"
- login: "chrstphrchvz"
- priority changed to: "5 Medium"
- private_contact changed to: "6133eb3026f9b10aa9b7b48da92ae2834fc225b0"
- resolution changed to: "None"
- severity changed to: "Minor"
- status changed to: "Open"
- submitter changed to: "chrstphrchvz"
- subsystem changed to: "10. Objects"
- title changed to: "Remove unreachable code in Tcl_SetWideIntObj()"
- type changed to: "Patch"