[Bug c/43755] Bit shifting by a 8 byte variable isn't the same as bit shifting by an 8 or a 4 byte constant on 64bit platform.
--- Comment #3 from jakub at gcc dot gnu dot org 2010-04-15 08:12 --- The only bug here is in your program. ISO C99, 6.5.7/3 says: ... "If the value of the right operand is negative or is greater than or equal to the width of the promoted left operand, the behavior is undefined." and that's what happens here. ~0 is 32-bit and shifting it by 32 is undefined behavior. -- jakub at gcc dot gnu dot org changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution||INVALID http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43755
[Bug c/43755] Bit shifting by a 8 byte variable isn't the same as bit shifting by an 8 or a 4 byte constant on 64bit platform.
--- Comment #2 from mail dot alexhaase at gmail dot com 2010-04-15 03:33 --- I tested on 32bits and found slightly less confusing, though still confusing results. Bug id #43756 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43755
[Bug c/43755] Bit shifting by a 8 byte variable isn't the same as bit shifting by an 8 or a 4 byte constant on 64bit platform.
--- Comment #1 from mail dot alexhaase at gmail dot com 2010-04-15 03:16 --- Created an attachment (id=20384) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=20384&action=view) Bug demo -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43755