Last Comment Bug 752374 - GCC integer overflow warnings in jsatominlines.h
: GCC integer overflow warnings in jsatominlines.h
Product: Core
Classification: Components
Component: JavaScript Engine (show other bugs)
: unspecified
: All All
: -- normal (vote)
: mozilla15
Assigned To: Brian Hackett (:bhackett)
: Jason Orendorff [:jorendorff]
Depends on:
Blocks: 751331
  Show dependency treegraph
Reported: 2012-05-06 16:28 PDT by Nicholas Nethercote [:njn]
Modified: 2012-05-07 16:10 PDT (History)
2 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

patch (497 bytes, patch)
2012-05-06 16:28 PDT, Nicholas Nethercote [:njn]
no flags Details | Diff | Splinter Review

Description Nicholas Nethercote [:njn] 2012-05-06 16:28:59 PDT
Created attachment 621473 [details] [diff] [review]

I'm getting millions of these from GCC:

../jsatominlines.h: In function ‘bool js::IndexToId(JSContext*, uint32_t, jsid*)’:
../jsatominlines.h:136:18: warning: integer overflow in expression [-Woverflow]
../jsatominlines.h: In function ‘jsid js::AtomToId(JSAtom*)’:
../jsatominlines.h:151:43: warning: integer overflow in expression [-Woverflow]

But 751331 seems to be the cause.

bhackett, the attached patch fixes the warnings, but I don't know if it's the right fix.
Comment 1 Brian Hackett (:bhackett) 2012-05-06 16:33:42 PDT
Comment on attachment 621473 [details] [diff] [review]

I think that INT32_MAX would be the best fix (didn't get these warnings with my GCC).
Comment 2 Brian Hackett (:bhackett) 2012-05-06 16:34:07 PDT
Oh, r+ if you want to check in the INT32_MAX fix.  Thanks!
Comment 3 Nicholas Nethercote [:njn] 2012-05-06 16:59:20 PDT

Note You need to log in before you can comment on or make changes to this bug.