http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47108
--- Comment #5 from Floris Ruijter <flo.ruijt at hotmail dot com> 2010-12-29 18:37:57 UTC --- On Wed, 2010-12-29 at 18:29 +0000, pinskia at gcc dot gnu.org wrote: > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47108 > > --- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> 2010-12-29 > 18:29:07 UTC --- > (In reply to comment #3) > > indeed it works then. i find the behaviour pretty obscure though, why is > > it that way? > > Because 1 is of type int and doing a shift on it does not change its type and > it is undefined what happens when the shiftor is greater than the size of the > type. So starting with 1LL and doing the shift will get you a value that is > correct. > ok, well i knéw C/C++ was obscure:p