Closed Bug 1277148 Opened 4 years ago Closed 4 years ago

[Static Analysis][Logically dead code] numIfEnd==0 in CheckIf() never succeeds

Categories

(Core :: JavaScript Engine: JIT, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla50
Tracking Status
firefox49 --- affected
firefox50 --- fixed

People

(Reporter: njn, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: coverity, Whiteboard: CID 1358962)

Attachments

(1 file)

Coverity detected that this code in CheckIf() never succeeds:

> if (numIfEnd == 0)
>   return false;

because numIfEnd is initialized to 1 and then is only incremented after that.

sunfish, can you take a look? Maybe the test should just be removed, or maybe something bigger needs to be done.
Flags: needinfo?(sunfish)
For more context, this is in AsmJS.cpp. Probably testing for overflow? Could be rewritten to be made more explicit, I guess...
Attached patch overflow.patchSplinter Review
Flags: needinfo?(sunfish)
Attachment #8759088 - Flags: review?(n.nethercote)
Comment on attachment 8759088 [details] [diff] [review]
overflow.patch

Review of attachment 8759088 [details] [diff] [review]:
-----------------------------------------------------------------

Your patch has r?sunfish in it but you asked me for review. I'm guessing you just typed the wrong name into the review request field...
Attachment #8759088 - Flags: review?(n.nethercote) → review?(sunfish)
Comment on attachment 8759088 [details] [diff] [review]
overflow.patch

Review of attachment 8759088 [details] [diff] [review]:
-----------------------------------------------------------------

Yes, that code is testing for overflow. The proposed change looks ok.
Attachment #8759088 - Flags: review?(sunfish) → review+
Pushed by bbouvier@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/55bd2af31d62
Make overflow testing more explicit in CheckIf; r=sunfish
https://hg.mozilla.org/mozilla-central/rev/55bd2af31d62
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla50
You need to log in before you can comment on or make changes to this bug.