--- Comment #5 from pinskia at gcc dot gnu dot org 2006-02-14 22:21 ---
(((uint(1) << (32 - i)) - 1) << 0)
That whole expression is undefined because 1 << 32 is undefined.
--
pinskia at gcc dot gnu dot org changed:
What|Removed |Added
--- Comment #4 from igodard at pacbell dot net 2006-02-14 22:18 ---
"undefined" takes care of the 4.0.2 case, and the first part of the Cygwin
case. But the shift that produces "d" in the Cygwin case has a right operand of
zero and a left operand (what the undefined gave as "c") also zer
--- Comment #3 from pinskia at gcc dot gnu dot org 2006-02-14 21:59 ---
Yep this is just undefined code.
5.8/1:
The behavior is undefined if the right operand is negative, or greater than or
equal to the length in bits of the promoted left operand.
--
pinskia at gcc dot gnu dot org c
--- Comment #2 from pinskia at gcc dot gnu dot org 2006-02-14 21:57 ---
I think there is a dup of this bug and this is code is undefined too. I have
to double check and get back to you.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26292
--- Comment #1 from igodard at pacbell dot net 2006-02-14 21:51 ---
FWIW, "uint(1) << 32" gives zero, but "int i = 32; uint(1) << i" gives one.
Ivan
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26292