Closed
Bug 472563
Opened 16 years ago
Closed 16 years ago
int wraparound bugs in 64bit builds
Categories
(Tamarin Graveyard :: Virtual Machine, defect)
Tracking
(Not tracked)
VERIFIED
FIXED
People
(Reporter: edwsmith, Unassigned)
References
Details
Attachments
(1 file)
2.51 KB,
patch
|
stejohns
:
review+
|
Details | Diff | Splinter Review |
if you run as3/Types/Int/wraparound.abc, a number of tests will say PASSED even though they print the wrong answers.
for example, comparing the 32bit and 64bit output (interpreter or jit, intel or ppc):
-uint.MIN_VALUE - 1 = 4294967295 = 4294967295 PASSED!
-uint.MIN_VALUE - 1 = 4294967295 = 4294967295 PASSED!
-decrement uint at uint.MIN_VALUE = 4294967295 PASSED!
-uint.MAX_VALUE * 2 = 4294967294 = 4294967294 PASSED!
+uint.MIN_VALUE - 1 = 4294967295 = -1 PASSED!
+uint.MIN_VALUE - 1 = 4294967295 = -1 PASSED!
+decrement uint at uint.MIN_VALUE = -1 PASSED!
+uint.MAX_VALUE * 2 = 4294967294 = -2 PASSED!
-uint.MAX_VALUE << 1 = 4294967294 PASSED!
+uint.MAX_VALUE << 1 = -2 PASSED!
(differential testing FTW!)
Comment 1•16 years ago
|
||
In the event that these are run in the interpreter; there is already an open bug (https://bugzilla.mozilla.org/show_bug.cgi?id=465754) on dodgy representations that may lead to strange bugs for int values in 64-bit builds. (May or may not be related, just wanted to note it.)
Reporter | ||
Comment 2•16 years ago
|
||
Looks like the problem is with string formatting; in a couple places we assume
kIntegerAtom implies int32_t, which isn't right. Pending fix does a range
check and does unsigned formatting if the value is > 0x7fffffff. Another fix
would be to change ConvertIntegerToStringBase10 to take intptr_t instead of
int32_t, and internally use a 22 byte buffer instead of 12 byte. This seems
safer; votes welcome.
Reporter | ||
Comment 3•16 years ago
|
||
Attachment #355904 -
Flags: review?(stejohns)
Updated•16 years ago
|
Attachment #355904 -
Flags: review?(stejohns) → review+
Reporter | ||
Comment 4•16 years ago
|
||
pushed changeset: 1267:2b497ebb2153
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Comment 5•16 years ago
|
||
verified that the as3/Types/Int/wraparound.abc produces the correct values using 32 and 64bit shells
Status: RESOLVED → VERIFIED
You need to log in
before you can comment on or make changes to this bug.
Description
•