Artifacts Associated With Ticket 1241572
Ticket change [c3e94555a4] (rid 111753) by nobody on 2005-07-20 13:52:06:
- assignee initialized to: "hobbs"
- cmimetype initialized to: "text/plain"
- comment initialized to:
% set x -2147483647; expr {abs($x)} 2147483647 % set x -2147483648; expr {abs($x)} integer value too large to represent % set x -2147483649; expr {abs($x)} 2147483649 This is a practical problem as we use -2147483648 (0x80000000, MIN_INT) to express missing data. Seen in 8.4.1 and 8.5a2 Tclkit, Windows XP and Linux. [email protected] - foundin initialized to: "None"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "nobody"
- subsystem initialized to: "11. Conversions from String"
- title initialized to: "[expr] blind spot at corner of 32/64 bit integers"
- type initialized to: "Bug"
Ticket change [1c7a0e4709] (rid 90612) by dkf on 2005-07-20 21:05:29:
- icomment:
Logged In: YES user_id=79902 Problem is it that it hits the "FIXME" case in ExprAbsFunc (in tclBasic.c in the HEAD.)
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
- icomment:
Ticket change [a5885f4afb] (rid 110391) by hobbs on 2005-07-21 00:20:25:
- assignee changed to: "kennykb"
Ticket change [31a6d8f197] (rid 93468) by kennykb on 2005-08-06 02:24:29:
- closedate changed to: "2005-08-05T19:24:29"
- closer changed to: "kennykb"
- icomment:
Logged In: YES user_id=99768 Right you are. Although in 8.4.11, you have to do expr {int(-2147483648)} to tickle the bug. Anyway, abs() is fixed. - login: "kennykb"
- mimetype: "text/plain"
- resolution changed to: "Fixed"
- status changed to: "Closed"
- username: "kennykb"
Ticket change [ffb154fd37] (rid 108796) by rmax on 2005-12-10 00:32:22:
- icomment:
Logged In: YES user_id=124643 This fix depends on implementation defined behaviour of the compiler and fails with gcc 4.1.0. What happens is, that the compiler decides that the negation of a negative number can never have a negative result, and so it optimizes away the special case for INT_MIN as dead code. There are two solutions for this: either rewriting the code so that it doesn't depend on the assumption that -MIN_INT == MIN_INT, or use the -fwrapv parameter to gcc, so that it guarantees the wrapping behaviour of integers. See also http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25329
- login: "rmax"
- mimetype: "text/plain"
- status changed to: "Open"
- username: "rmax"
- icomment:
Ticket change [1a818dff66] (rid 122986) by rmax on 2005-12-10 00:39:50:
- resolution changed to: "None"
Add attachment "tcl-abs.patch" [eafb67e55a] (rid 103461) by rmax on 2005-12-10 01:13:03.
Ticket change [8ed4d683b7] (rid 120180) by rmax on 2005-12-10 01:13:03:
- icomment:
File Added - 159278: tcl-abs.patch
- login: "rmax"
- mimetype: "text/plain"
- username: "rmax"
- icomment:
Ticket change [426a77ab2a] (rid 116376) by nobody on 2005-12-12 17:38:51:
- icomment:
Logged In: NO Hmm - my patch fixes 32bit platform, but it breaks 64bit :( How about using MIN_INT from limits.h for checking this special case, and providing compatibility definitions for platforms that don't have limits.h?
- login: "nobody"
- mimetype: "text/plain"
- username: "nobody"
- icomment:
Ticket change [632f38091c] (rid 92534) by rmax on 2005-12-12 18:38:40:
- closedate changed to: "2005-12-12T11:38:40"
- closer changed to: "rmax"
- icomment:
Logged In: YES user_id=124643 I just committed the attached patch to the 8.4 branch. It assumes that MIN_LONG is defined by one of the headers that are being included already. If there is any platform where this isn't true, a compatibility definition needs to be added.
- login: "rmax"
- mimetype: "text/plain"
- resolution changed to: "Fixed"
- status changed to: "Closed"
- username: "rmax"
Add attachment "tcl-abs.patch" [7085940e42] (rid 100494) by rmax on 2005-12-12 18:38:41.
Ticket change [8e9a85e96a] (rid 120139) by rmax on 2005-12-12 18:38:42:
- icomment:
File Added - 159527: tcl-abs.patch
- login: "rmax"
- mimetype: "text/plain"
- username: "rmax"
- icomment: