https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103826

--- Comment #2 from Jörn Heusipp <manx-bugzilla at problemloesungsmaschine dot 
de> ---
(In reply to Andrew Pinski from comment #1)

> Note I notice clang warns about:
> int main() {
>     return (0x7000'0000) << 4;
> }

It's valid, but clang complains here about shifting bits out of the range of
the target type:
warning: signed shift result (0x700000000) requires 36 bits to represent, but
'int' only has 32 bits [-Wshift-overflow]

It does not warn when only shifting into the sign bit (and not overflowing the
bits of the target type):
return (0x7000'0000) << 1;

I am not sure what the intended semantics of -Wshift-overflow is for clang, but
I have reported <https://github.com/llvm/llvm-project/issues/52873>.
  • [Bug c++/1038... manx-bugzilla at problemloesungsmaschine dot de via Gcc-bugs
    • [Bug c++... pinskia at gcc dot gnu.org via Gcc-bugs
    • [Bug c++... manx-bugzilla at problemloesungsmaschine dot de via Gcc-bugs

Reply via email to