Last Comment Bug 742788 - js/src/jsinterp.cpp:954:31: warning: comparison of unsigned expression >= 0 is always true
: js/src/jsinterp.cpp:954:31: warning: comparison of unsigned expression >= 0 i...
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: JavaScript Engine (show other bugs)
: Trunk
: x86_64 Linux
: -- normal (vote)
: mozilla14
Assigned To: Daniel Holbert [:dholbert] (largely AFK until June 28)
:
Mentors:
Depends on: 688891 713311
Blocks: buildwarning
  Show dependency treegraph
 
Reported: 2012-04-05 10:30 PDT by Daniel Holbert [:dholbert] (largely AFK until June 28)
Modified: 2012-04-06 11:32 PDT (History)
2 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
fix (1.32 KB, patch)
2012-04-05 10:36 PDT, Daniel Holbert [:dholbert] (largely AFK until June 28)
luke: review+
Details | Diff | Review

Description Daniel Holbert [:dholbert] (largely AFK until June 28) 2012-04-05 10:30:14 PDT
Filing bug on these build warnings:
{
js/src/jsinterp.cpp: In function ‘void LeaveWith(JSContext*)’:
js/src/jsinterp.cpp:954:31: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
js/src/jsopcode.cpp: In member function ‘char& js::Sprinter::operator[](size_t)’:
js/src/jsopcode.cpp:778:14: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
}

In both cases, we're just asserting that a value is nonnegative, and in both cases the value is unsigned so the assertion will trivially always pass.
Comment 1 Daniel Holbert [:dholbert] (largely AFK until June 28) 2012-04-05 10:36:18 PDT
Created attachment 612601 [details] [diff] [review]
fix

In this patch's first chunk, the stackDepth method on WithObject returns uint32, as shown here:
 http://mxr.mozilla.org/mozilla-central/source/js/src/vm/ScopeObject.h#188
(the method is inherited from NestedScopeObject)
So that's unsigned.

And the second chunk directly deals with a size_t variable, which is unsigned by definition.
Comment 2 Daniel Holbert [:dholbert] (largely AFK until June 28) 2012-04-05 10:42:17 PDT
FWIW, it looks like patch's first chunk (and the stackDepth() method that it calls) was added in Bug 713311:
 http://hg.mozilla.org/mozilla-central/rev/f0d76403ae9c#l25.176
and the second chunk (in jsopcode.cpp) was added in Bug 688891:
 http://hg.mozilla.org/mozilla-central/diff/24dac171a324/js/src/jsopcode.cpp#l1.162
Comment 3 Luke Wagner [:luke] 2012-04-05 10:43:08 PDT
Comment on attachment 612601 [details] [diff] [review]
fix

lol.  To wit, I have the LeaveWith case nixed in a patch in my queue :)
Comment 4 Daniel Holbert [:dholbert] (largely AFK until June 28) 2012-04-05 10:47:37 PDT
(In reply to Luke Wagner [:luke] from comment #3)
> lol.  To wit, I have the LeaveWith case nixed in a patch in my queue :)

Great minds think alike! :)
Comment 5 Daniel Holbert [:dholbert] (largely AFK until June 28) 2012-04-05 10:59:48 PDT
https://hg.mozilla.org/integration/mozilla-inbound/rev/b1db4217e068
Comment 6 Matt Brubeck (:mbrubeck) 2012-04-06 11:32:30 PDT
https://hg.mozilla.org/mozilla-central/rev/b1db4217e068

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