Closed Bug 1410622 Opened 7 years ago Closed 7 years ago

TiledRegion.cpp : ccomparison 'uint64_t' (aka 'unsigned long') > 18446744073709551615 is always false [-Werror,-Wtautological-constant-compare]

Categories

(Core :: Graphics, defect, P3)

defect

Tracking

()

RESOLVED FIXED
mozilla58
Tracking Status
firefox56 --- wontfix
firefox57 --- wontfix
firefox58 --- fixed

People

(Reporter: Sylvestre, Assigned: andi)

References

(Blocks 1 open bug)

Details

(Whiteboard: [gfx-noted])

Attachments

(1 file)

/data/jenkins/workspace/firefox-clang-last/gfx/src/TiledRegion.cpp:143:29: error: comparison 'uint64_t' (aka 'unsigned long') > 18446744073709551615 is always false [-Werror,-Wtautological-constant-compare]
     return ((uint64_t)total > (uint64_t)SIZE_MAX) ? SIZE_MAX : (size_t)total;
             ~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~
Assignee: nobody → bpostelnicu
Attachment #8921026 - Flags: review?(bugmail)
Comment on attachment 8921026 [details]
Bug 1410622 - Prevent warning on 64bit systems when comparing uint64_t with size_t max value.

https://reviewboard.mozilla.org/r/191986/#review197238

::: gfx/src/TiledRegion.cpp:142
(Diff revision 1)
>      int64_t tilesInLastRow = ((int64_t)mEnd.x - (int64_t)mTileBounds.x1) / kTileSize;
>      int64_t tilesInFullRow = ((int64_t)mTileBounds.x2 - (int64_t)mTileBounds.x1) / kTileSize;
>      int64_t total = tilesInFirstRow + (tilesInFullRow * numberOfFullRows) + tilesInLastRow;
>      MOZ_ASSERT(total > 0);
> -    // The total may be larger than what fits in a size_t, so clamp it to
> -    // SIZE_MAX in that case.
> +    // On 32bit systems the total may be larger than what fits in a size_t (4 bytes),
> +    // so clamp it to SIZE_MAX in that case.

Update this comment so it says "size_t's max value" instead of SIZE_MAX since the code is no longer using SIZE_MAX.
Attachment #8921026 - Flags: review?(bugmail) → review+
Pushed by bpostelnicu@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/7aa291217448
Prevent warning on 64bit systems when comparing uint64_t with size_t max value. r=kats
https://hg.mozilla.org/mozilla-central/rev/7aa291217448
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla58
No longer blocks: clang-based-analysis
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: