Closed Bug 1316159 Opened 3 years ago Closed Last year

clang-cl build warning in stackwalker_mips.cc ("comparison of constant 18446744073709551615 with expression of type 'bool' is always false [-Wtautological-constant-out-of-range-compare]")

Categories

(Toolkit :: Crash Reporting, defect)

defect
Not set

Tracking

()

RESOLVED FIXED

People

(Reporter: dmajor, Assigned: gsvelto)

References

(Blocks 1 open bug)

Details

The paren grouping on these 'if' statements is wrong.

Given that this code is for MIPS, this is totally not worth fixing on our side nor picking up a new Breakpad just for this, but Ted maybe you'd be interested in fixing this upstream?

 0:22.36 d:/build/msys/s/central/toolkit/crashreporter/google-breakpad/src/processor/stackwalker_mips.cc(60,9):  warning(clang): comparison of constant 18446744073709551615 with expression of type 'bool' is always false [-Wtautological-constant-out-of-range-compare]
 0:22.36         > 0xffffffffffffffff) {
 0:22.36         ^ ~~~~~~~~~~~~~~~~~~
 0:22.36 d:/build/msys/s/central/toolkit/crashreporter/google-breakpad/src/processor/stackwalker_mips.cc(68,66):  warning(clang): comparison of constant 4294967295 with expression of type 'bool' is always false [-Wtautological-constant-out-of-range-compare]
 0:22.36     if ((memory_ && memory_->GetBase() + memory_->GetSize() - 1) > 0xffffffff) {
 0:22.36         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~
It's for MIPS, but it gets build as part of the stackwalker on all platforms, which is why we're building it. If it's just a simple patch then we can definitely upstream it.
I think the intent was for this:

    if ((memory_ && memory_->GetBase() + memory_->GetSize() - 1) > 0xffffffff) {

to look more like this:

    if (memory_ && (memory_->GetBase() + memory_->GetSize() - 1) > 0xffffffff) {

which should be sufficient for the 32-bit case, since GetBase() is uint64_t. But the code above it, comparing against 0xffffffffffffffff, may have an overflow bug on top of the paren problem.
We'd like to update breakpad more often so that it's less painful than the last time. I'll make sure this goes in before we do it the next time.
Depends on: 1309172
FWIW, this was fixed upstream here:
https://chromium.googlesource.com/breakpad/breakpad/+/fd28a5bbe9a3fde97c90f0928b62894d597f2f6a%5E%21/#F0
Blocks: buildwarning
Summary: clang-cl build warning in stackwalker_mips.cc → clang-cl build warning in stackwalker_mips.cc ("comparison of constant 18446744073709551615 with expression of type 'bool' is always false [-Wtautological-constant-out-of-range-compare]")
This was fixed in bug 1309172.
Assignee: nobody → gsvelto
Status: NEW → RESOLVED
Closed: Last year
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.