This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Compiler bug....
- To: dirk dot derycke at icos dot be
- Subject: Re: Compiler bug....
- From: Nathan Sidwell <nathan at acm dot org>
- Date: Fri, 29 Oct 1999 13:15:06 +0100
- CC: bug-gcc at gnu dot org, bugs at gcc dot gnu dot org
- References: <C1256819.00407757.00@icosdmz.icos.be>
- Reply-To: nathan at cs dot bris dot ac dot uk
dirk.derycke@icos.be wrote:
>
> I have the following strange error that occurs when compiling WITHOUT
> optimizations
>
> const unsigned short shift = 32;
> unsigned int res;
>
> res = 1 << shift;
>
> normally this fragment should cause an overflow and res should become zero
Nope. (assuming unsigned int contains no more than 32 representable bits)
'If the value of the right operand is negative or is greater than
or equal to the number of value and sign bits in the object
representation of the promoted left operand, the behaviour is
undefined.'
nathan
--
Dr Nathan Sidwell :: Computer Science Department :: Bristol University
I have seen the death of PhotoShop -- it is called GIMP
nathan@acm.org http://www.cs.bris.ac.uk/~nathan/ nathan@cs.bris.ac.uk