This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: gcc bug
- To: Pawel Palucha <pp174750 at zodiac dot mimuw dot edu dot pl>
- Subject: Re: gcc bug
- From: Nathan Sidwell <nathan at codesourcery dot com>
- Date: Mon, 06 Mar 2000 09:51:56 +0000
- CC: egcs-bugs at egcs dot cygnus dot com
- Organization: CodeSourcery, LLC
- References: <Pine.LNX.4.10.10003061034150.8543-100000@zodiac.mimuw.edu.pl>
Pawel Palucha wrote:
> Perhaps I'm wrong, but I though that "unsigned long k = 1UL << 32" is the
> same as "int i = 32; unsigned long k = 1UL << i".
No. `expr << shift' invokes undefined behaviour when `shift' is negative
or greater or equal to the length in bits of `expr'. You have 32bit
longs, so have invoked undefined behaviour -- anything can happen.
nathan
--
Dr Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
'But that's a lie.' - 'Yes it is. What's your point?'
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org