Closed Bug 400393 Opened 18 years ago Closed 18 years ago

mozilla-central: jsatom.cpp has bad casts in 64-bit OS

Categories

(Core :: JavaScript Engine, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9beta2

People

(Reporter: benjamin, Assigned: benjamin)

Details

Attachments

(1 file, 1 obsolete file)

jsatom.cpp has bad casts on a 64-bit OS: you aren't allowed to cast a pointer directly to a uint32... you always have to go through a uintN first.
JS_PTR_TO_{,U}INT32 stand ready. Where are these errors? Igor, can you fix? /be
Attached patch Make it cast correctly, rev. 1 (obsolete) — Splinter Review
This is the patch I thought I attached the first time... :-(
Attachment #285485 - Flags: review?(igor)
Comment on attachment 285485 [details] [diff] [review] Make it cast correctly, rev. 1 Right-justify backslash to column 79 for prevailing style match. /be
Comment on attachment 285485 [details] [diff] [review] Make it cast correctly, rev. 1 >diff --git a/js/src/jsatom.h b/js/src/jsatom.h >--- a/js/src/jsatom.h >+++ b/js/src/jsatom.h >@@ -74,7 +74,7 @@ JS_STATIC_ASSERT(sizeof(JSAtom *) == JS_ > #if JS_BYTES_PER_WORD == 4 > # define ATOM_HASH(atom) ((JSHashNumber)(atom) >> 2) > #elif JS_BYTES_PER_WORD == 8 >-# define ATOM_HASH(atom) (((JSHashNumber)(atom) >> 3) ^ \ >+# define ATOM_HASH(atom) (((JSHashNumber)(jsuword)(atom) >> 3) ^ \ > (JSHashNumber)((jsuword)(atom) >> 32)) Nit: put \ in the column 78 as it was before the patch. r+ with that fixed.
(In reply to comment #4) > (From update of attachment 285485 [details] [diff] [review]) > >diff --git a/js/src/jsatom.h b/js/src/jsatom.h > >--- a/js/src/jsatom.h > >+++ b/js/src/jsatom.h > >@@ -74,7 +74,7 @@ JS_STATIC_ASSERT(sizeof(JSAtom *) == JS_ > > #if JS_BYTES_PER_WORD == 4 > > # define ATOM_HASH(atom) ((JSHashNumber)(atom) >> 2) > > #elif JS_BYTES_PER_WORD == 8 > >-# define ATOM_HASH(atom) (((JSHashNumber)(atom) >> 3) ^ \ > >+# define ATOM_HASH(atom) (((JSHashNumber)(jsuword)(atom) >> 3) ^ \ > > (JSHashNumber)((jsuword)(atom) >> 32)) > > Nit: put \ in the column 78 as it was before the patch. I meant 79 in editors that counts columns from 1.
Pushed to mozilla-central. Igor, could you go ahead and set the review flag when you do reviews so that my review requests stay clean?
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
This should get patched in cvs.mozilla.org too. /be
Why fix in CVS? This isn't a problem in C, only in C++ due to different casting rules.
(In reply to comment #6) > Pushed to mozilla-central. Igor, could you go ahead and set the review flag > when you do reviews so that my review requests stay clean? Do you have a patch to attach with the nit addressed?
(In reply to comment #8) > Why fix in CVS? This isn't a problem in C, only in C++ due to different casting > rules. Two reasons: 1. To allow 1.9 and mozilla-central to stay as close as possbile. 2. To allow to use C++ compiler with 1.9.
(In reply to comment #8) > Why fix in CVS? This isn't a problem in C, only in C++ due to different casting > rules. Igor replied, but did not cite bug 357016 which was fixed on cvs.m.o in reason 2. Connect the dots, and don't make gratuitous small changes between SpiderMonkey in cvs and hg, please. /be
New patch... though if you're going to say r+ in comments with a nit changed, you might as well mark it so.
Assignee: general → benjamin
Attachment #285485 - Attachment is obsolete: true
Status: RESOLVED → ASSIGNED
Attachment #285501 - Flags: review?(igor)
Attachment #285501 - Flags: approval1.9?
Attachment #285485 - Flags: review?(igor)
Resolution: FIXED → ---
Attachment #285501 - Flags: review?(igor) → review+
(In reply to comment #12) > Created an attachment (id=285501) [details] > Make it cast correctly, rev. 1.1 > > New patch... Thanks, I just wanted to have a patch to apply to 1.9 as well. Do you have CVS access to commit the patch (after getting a+)?
Attachment #285501 - Flags: approval1.9? → approval1.9+
Keywords: checkin-needed
Checking in js/src/jsatom.h; /cvsroot/mozilla/js/src/jsatom.h,v <-- jsatom.h new revision: 3.77; previous revision: 3.76 done
Status: ASSIGNED → RESOLVED
Closed: 18 years ago18 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9 M10
Flags: in-testsuite-
Flags: in-litmus-
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: