This is an archive of the discontinued LLVM Phabricator instance.

[builtins] Fix -Wshift-count-overflow warnings for targets with 16-bit int
ClosedPublic

Authored by uabelho on Apr 4 2023, 12:59 AM.

Details

Summary

Without this fix we got warnings like
/repo/llvm/compiler-rt/lib/builtins/floattidf.c:67:29: warning: shift count >= width of type [-Wshift-count-overflow]

((e + 1023) << 20) |              // exponent
            ^  ~~

1 warning generated.
when compiling for a target with 16-bit int.

In floatundisf.c the type of "e" was already changed to "si_int" in
https://reviews.llvm.org/D78662, now we do the same in a couple
of other files where "e" is also left shifted 20/23 steps.

Diff Detail

Event Timeline

uabelho created this revision.Apr 4 2023, 12:59 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 4 2023, 12:59 AM
Herald added subscribers: Enna1, bjope. · View Herald Transcript
uabelho requested review of this revision.Apr 4 2023, 12:59 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 4 2023, 12:59 AM
Herald added a subscriber: Restricted Project. · View Herald Transcript
Ka-Ka added a subscriber: Ka-Ka.Apr 4 2023, 7:24 AM
This revision is now accepted and ready to land.Apr 12 2023, 10:45 AM
MaskRay accepted this revision.Apr 12 2023, 11:18 AM