LinearScan.cpp:996:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

RESOLVED FIXED in mozilla33

Status

()

RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: dholbert, Assigned: bbouvier)

Tracking

(Blocks: 1 bug)

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

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

5 years ago
New group of build warnings in mozilla-central:
{
 2:20.67 $SRCDIRjs/src/jit/LinearScan.cpp: In member function 'js::jit::AnyRegister::Code js::jit::LinearScanAllocator::findBestFreeRegister(js::jit::CodePosition*)':
 2:20.67 Warning: -Wsign-compare in $SRCDIRjs/src/jit/LinearScan.cpp: comparison between signed and unsigned integer expressions
 2:20.67 $SRCDIRjs/src/jit/LinearScan.cpp:996:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 2:20.67              for (int a = 0; a < reg.numAliased(); a++) {
 2:20.67                                ^
 2:20.67 Warning: -Wsign-compare in $SRCDIRjs/src/jit/LinearScan.cpp: comparison between signed and unsigned integer expressions
 2:20.67 $SRCDIRjs/src/jit/LinearScan.cpp:1007:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 2:20.67              for (int a = 0; a < reg.numAliased(); a++) {
 2:20.67                                ^
 2:20.67 Warning: -Wsign-compare in $SRCDIRjs/src/jit/LinearScan.cpp: comparison between signed and unsigned integer expressions
 2:20.67 $SRCDIRjs/src/jit/LinearScan.cpp:1020:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 2:20.67              for (int a = 0; a < reg.numAliased(); a++) {
 2:20.67                                ^
 2:20.68 Warning: -Wsign-compare in $SRCDIRjs/src/jit/LinearScan.cpp: comparison between signed and unsigned integer expressions
 2:20.68 $SRCDIRjs/src/jit/LinearScan.cpp:1042:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 2:20.68              for (int a = 0; a < prevReg.numAliased(); a++) {
 2:20.68                                ^
 2:20.68 Warning: -Wsign-compare in $SRCDIRjs/src/jit/LinearScan.cpp: comparison between signed and unsigned integer expressions
 2:20.68 $SRCDIRjs/src/jit/LinearScan.cpp:1059:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 2:20.68          for (int a = 0; a < hintReg.numAliased(); a++) {
 2:20.68                            ^
 2:20.68 Warning: -Wsign-compare in $SRCDIRjs/src/jit/LinearScan.cpp: comparison between signed and unsigned integer expressions
 2:20.68 $SRCDIRjs/src/jit/LinearScan.cpp:1073:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 2:20.68              for (int a = 0; a < hintReg.numAliased(); a++) {
 2:20.68                                ^
 2:20.68 $SRCDIRjs/src/jit/LinearScan.cpp: In member function 'js::jit::AnyRegister::Code js::jit::LinearScanAllocator::findBestBlockedRegister(js::jit::CodePosition*)':
 2:20.69 Warning: -Wsign-compare in $SRCDIRjs/src/jit/LinearScan.cpp: comparison between signed and unsigned integer expressions
 2:20.69 $SRCDIRjs/src/jit/LinearScan.cpp:1124:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 2:20.69              for (int a = 0; a < fullreg.numAliased(); a++) {
 2:20.69                                ^
 2:20.69 Warning: -Wsign-compare in $SRCDIRjs/src/jit/LinearScan.cpp: comparison between signed and unsigned integer expressions
 2:20.69 $SRCDIRjs/src/jit/LinearScan.cpp:1142:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 2:20.69              for (int a = 0; a < reg.numAliased(); a++) {
 2:20.69                                ^
 2:20.69 Warning: -Wsign-compare in $SRCDIRjs/src/jit/LinearScan.cpp: comparison between signed and unsigned integer expressions
 2:20.69 $SRCDIRjs/src/jit/LinearScan.cpp:1155:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 2:20.69              for (int a = 0; a < fullreg.numAliased(); a++) {
 2:20.69                                ^
}
(I'm using GCC 4.9, but I'm pretty sure all gcc & clang versions will warn about this.)

This all seems to be code added today in bug 991153.

Marty, mind fixing?  (numAliased seems to be uint32_t, so presumably that's the type we should be using for our loop counters)
(Reporter)

Updated

5 years ago
Flags: needinfo?(mrosenberg)
Created attachment 8446410 [details] [diff] [review]
bug1030605.patch

Pretty sure I made a remark in the review re: using int32_t or size_t in this case rather than plain int. Whatever, let's make the compiler shut up :)
Assignee: nobody → benj
Status: NEW → ASSIGNED
Attachment #8446410 - Flags: review?(mrosenberg)
Flags: needinfo?(mrosenberg)
Attachment #8446410 - Flags: review?(mrosenberg) → review+
(In reply to Benjamin Bouvier [:bbouvier] from comment #1)
> Created attachment 8446410 [details] [diff] [review]
> bug1030605.patch
> 
> Pretty sure I made a remark in the review re: using int32_t or size_t in
> this case rather than plain int. Whatever, let's make the compiler shut up :)

Ahh, I did not realize that you meant *everywhere*.  I also suspect most of these were from patches that you didn't review.
https://hg.mozilla.org/mozilla-central/rev/2cbeb71ab04b
Status: ASSIGNED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla33
You need to log in before you can comment on or make changes to this bug.