Closed Bug 1020892 Opened 5 years ago Closed 5 years ago

Bogus comparisons in js/src/jsstr.cpp and js/src/vm/String.h

Categories

(Core :: JavaScript Engine, defect)

x86
macOS
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla32

People

(Reporter: jwatt, Assigned: jandem)

Details

Attachments

(1 file)

There are a bunch of "comparison ... is always true" warnings in these files.
Or "is always false".
I don't see these locally (Clang 3.4.1) but I see them in a TBPL log.

This is from my Latin1 string patches; we templatized some code to work on both char types and something like "char <= 0xff" is always true for Latin1 chars.

It's nice the compiler knows this because it can optimize away these branches for Latin1 strings, but we don't want the warnings of course.
Assignee: nobody → jdemooij
Status: NEW → ASSIGNED
Attached patch PatchSplinter Review
I don't get these warnings with GCC 4.8 either, but I see them with GCC 4.7.

A jschar(c) cast is not enough to quell them; I had to add a jschar variable in StaticStrings::lookup.

Anyway, it's cool the compiler can optimize these branches for Latin1 strings :)
Attachment #8434895 - Flags: review?(luke)
Attachment #8434895 - Flags: review?(luke) → review+
https://hg.mozilla.org/mozilla-central/rev/74f5be69e4c9
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla32
You need to log in before you can comment on or make changes to this bug.