[Bug c/98418] Valid integer constant expressions based on expressions that trigger -Wshift-overflow are treated as non-constants
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98418 --- Comment #1 from Andrew Pinski --- Shifting into the sign bit is problematic. I cant remember the exact rules. Using ull is valid though.
[Bug c/98418] Valid integer constant expressions based on expressions that trigger -Wshift-overflow are treated as non-constants
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98418 --- Comment #2 from pskocik at gmail dot com --- You're right. The bug was in my code. struct foo { unsigned bit: (0xll<<40)!=0; }; is indeed UB due to http://port70.net/~nsz/c/c11/n1570.html#6.5.7p4, but struct foo { unsigned bit: (0xull<<40)!=0; }; isn't and GCC accepts it without complaint. Apologies for the false alarm.
[Bug c/98418] Valid integer constant expressions based on expressions that trigger -Wshift-overflow are treated as non-constants
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98418 pskocik at gmail dot com changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #3 from pskocik at gmail dot com --- You're right. The bug was in my code. struct foo { unsigned bit: (0xll<<40)!=0; }; is indeed UB due to http://port70.net/~nsz/c/c11/n1570.html#6.5.7p4, but struct foo { unsigned bit: (0xull<<40)!=0; }; isn't and GCC accepts it without complaint. Apologies for the false alarm.