This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH to fold in convert_ieee_real_to_integer
Per Bothner writes:
> Andrew Haley wrote:
> > Per Bothner writes:
> > > While looking into how constant fields propagate, I found that
> > > convert_ieee_real_to_integer doesn't constant-fold. I think it
> > > should. Andrew, I believe this is your code, so please take a
> > > look. You might also want to re-format. Normally, we do fold
> > > fold (build (...)) rather than build (...., fold (...)), so I
> > > should move the fold calls (pysically, not logically).
> >
> > I think this was deliberate, because at the time fold() wasn't doing
> > the Right Thing with respect to Java. However, this was a very long
> > time ago and it's perfectly possible that my memory is inaccurate.
>
> Alternatively, we can just explicitly test whether the incoming argument
> is constant.
>
> However, the following valid initialization currently causes the
> compiler to crash:
>
> public final static long c = (long) 2345.67;
>
> Could you look into the correct fix?
Sure.
Andrew.