On Wed, 19 Oct 2022, Jakub Jelinek wrote:

> > +/* Likewise, for overflow from long to long long.  */
> > +#if __LONG_LONG_MAX__ > __LONG_MAX__
> > +enum e5 { e5a = __LONG_MAX__,
> > +     e5b, e5c, e5d = ((typeof (e5b)) -1) < 0,
> > +     e5e = (unsigned long) -1,
> > +     e5f, e5g = ((typeof (e5e)) -1) > 0,
> > +     TYPE_CHECK (e5a, long), TYPE_CHECK (e5e, unsigned long) };
> 
> This fails on x86_64-linux with -m32 and I assume most other 32-bit
> targets, it works with
>         TYPE_CHECK (e5a, int), TYPE_CHECK (e5e, unsigned long) };
> Haven't checked in detail, but if int and long have the same bitsize,
> doesn't __LONG_MAX__ fit into int and so this new handling of large
> enumerators doesn't apply?
> Can we just change that unconditionally, or shall it be conditional
> on #if __LONG_MAX__ > __INT_MAX__ (then use long, otherwise int)?

I think the type checked for e5a should be conditional on __LONG_MAX__ > 
__INT_MAX__; everything else there should be OK regardless.

-- 
Joseph S. Myers
jos...@codesourcery.com

Reply via email to