This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: A long long int bug
- To: root <jhpb at sarto dot gaithersburg dot md dot us>
- Subject: Re: A long long int bug
- From: Branko Cibej <branko dot cibej at hermes dot si>
- Date: Mon, 02 Mar 1998 13:31:43 +0100
- Cc: egcs at cygnus dot com
- Organization: HERMES SoftLab
- References: <February_27_1998_at_05_16_38_11567_Joseph_H._Buehler@altera> <ra4ocprg.fsf@altera.gaithersburg.md.us>
> > 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