js/src/jsinterp.cpp:954:31: warning: comparison of unsigned expression >= 0 is always true

RESOLVED FIXED in mozilla14

Status

()

defect
RESOLVED FIXED
8 years ago
8 years ago

People

(Reporter: dholbert, Assigned: dholbert)

Tracking

(Blocks 1 bug)

Trunk
mozilla14
x86_64
Linux
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

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.
Posted patch fixSplinter Review
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.
Attachment #612601 - Flags: review?
Attachment #612601 - Flags: review? → review?(luke)
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
Depends on: 688891, 713311
Comment on attachment 612601 [details] [diff] [review]
fix

lol.  To wit, I have the LeaveWith case nixed in a patch in my queue :)
Attachment #612601 - Flags: review?(luke) → review+
(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! :)
https://hg.mozilla.org/mozilla-central/rev/b1db4217e068
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.