This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
RE: Char shifts promoted to int. Why?
- From: "Dave Korn" <dave dot korn at artimi dot com>
- To: "'Robert Dewar'" <dewar at adacore dot com>, "'Chris Lattner'" <clattner at apple dot com>
- Cc: "'Rask Ingemann Lambertsen'" <rask at sygehus dot dk>, "'Paul Brook'" <paul at codesourcery dot com>, <gcc at gcc dot gnu dot org>, "'Paul Schlie'" <schlie at comcast dot net>
- Date: Mon, 18 Dec 2006 19:34:17 -0000
- Subject: RE: Char shifts promoted to int. Why?
On 18 December 2006 19:31, Robert Dewar wrote:
> Chris Lattner wrote:
>
>> Thus, the transformation is safe in this specific case on i386.
>> However, shifting a 32-bit value left by 33 bits would not be safe.
>
> That's the case where the transformation IS safe, since shifting a
> 32-bit value left by 33 bits gives an undefined result as I understand
> things.
Only a compiler developer could say "It's safe because it's undefined so it
doesn't matter what it does"! :)
I'm fairly sure most /users/ would call undefined behaviour dangerous...
cheers,
DaveK
--
Can't think of a witty .sigline today....