Closed
Bug 194187
Opened 23 years ago
Closed 23 years ago
64bit unclean code in jsemit.h
Categories
(Core :: JavaScript Engine, defect, P1)
Tracking
()
VERIFIED
FIXED
mozilla1.3final
People
(Reporter: pthomas, Assigned: brendan)
Details
(Keywords: 64bit, js1.5)
Attachments
(1 file)
|
737 bytes,
patch
|
shaver
:
review+
dbaron
:
approval1.3+
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; de-AT; rv:1.2.1) Gecko/20021204
Build Identifier: Mozilla/5.0 (X11; U; Linux x86_64; de-AT; rv:1.2.1) Gecko/20021204
jsemit.h has this:
#define BITS_PER_PTRDIFF (sizeof(ptrdiff_t) * JS_BITS_PER_BYTE)
#define BITS_PER_BPDELTA (BITS_PER_PTRDIFF - 1 - JT_UNTAG_SHIFT)
#define BPDELTA_MAX ((ptrdiff_t)(JS_BIT(BITS_PER_BPDELTA) - 1))
And jstypes.h has:
/***********************************************************************
** MACROS: JS_BIT
** JS_BITMASK
** DESCRIPTION:
** Bit masking macros. XXX n must be <= 31 to be portable
***********************************************************************/
#define JS_BIT(n) ((JSUint32)1 << (n))
#define JS_BITMASK(n) (JS_BIT(n) - 1)
Which of course leads to gcc warning:
warning: left shift count >= width of type
when actually using BPDELTA_MAX, as shifting a JSUint32 by 64 bits definitely
exceeds its size.
I'd propose to change the definition of BPDELTA_MAX to
#define BPDELTA_MAX ((ptrdiff_t)(((prtdiff_t)1 << BITS_PER_BPDELTA)
- 1))
Reproducible: Always
Steps to Reproduce:
Just look at the code :)
| Reporter | ||
Comment 1•23 years ago
|
||
I forgot to state that this comes from compiling Mozilla on x86-64, aka AMD
Hammer, which uses the LP64 model, i.e. long and pointer are 64 bit long, so
sizeof(ptrdiff_t) is 8.
Updated•23 years ago
|
Status: UNCONFIRMED → NEW
Ever confirmed: true
| Assignee | ||
Comment 4•23 years ago
|
||
Oops. Sorry about that.
I don't think two casts are needed -- the inner (ptrdiff_t) cast applied to 1
should suffice to yield the right type for the entire expression that is the
macro's definition. Please let me know if this patch is good soon, and I will
try to get it into 1.3 final. Thanks,
/be
| Assignee | ||
Comment 5•23 years ago
|
||
I'll take this.
/be
Assignee: khanson → brendan
Severity: normal → critical
Priority: -- → P1
Target Milestone: --- → mozilla1.3final
| Assignee | ||
Updated•23 years ago
|
Attachment #115025 -
Flags: review?(shaver)
| Assignee | ||
Comment 6•23 years ago
|
||
This is an easy portability fix to get into 1.3final.
/be
Flags: blocking1.3?
Updated•23 years ago
|
Attachment #115025 -
Flags: review?(shaver) → review+
| Assignee | ||
Updated•23 years ago
|
Attachment #115025 -
Flags: approval1.3?
Attachment #115025 -
Flags: approval1.3? → approval1.3+
Comment 7•23 years ago
|
||
Comment on attachment 115025 [details] [diff] [review]
proposed fix
a=asa (on behalf of drivers) for checkin to 1.3
| Assignee | ||
Comment 8•23 years ago
|
||
Fixed.
/be
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Updated•23 years ago
|
Flags: blocking1.3?
You need to log in
before you can comment on or make changes to this bug.
Description
•