This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: A long long int bug


> > main ()
> > {
> >   unsigned long long int x;
> >
> >   if (sizeof (x) > sizeof (int))
> >   {
> >     x = 1UL << 33UL;
> >     if (x == 0)
> >       abort ();
> >   }
> >
> >   return 0;
> > }
>
> It works OK if you use 1ULL.  Whether that is correct behavior I would
> not venture to say.

It is indeed correct. The promotion from 'unsigned long' to 'unsinged long
long' happens in the assignment, not before.

--
Branko Cibej   <branko.cibej@hermes.si>
HERMES SoftLab, Litijska 51, 1000 Ljubljana, Slovenia
phone: (++386 61) 186 53 49  fax: (++386 61) 186 52 70




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]