This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][RFC] Fix PR30364, reassociation not allowed for undefined overflow
Richard Guenther <rguenther@suse.de> writes:
> On Thu, 22 Feb 2007, Ian Lance Taylor wrote:
>
> > Richard Guenther <rguenther@suse.de> writes:
> >
> > > ! if ((FLOAT_TYPE_P (type) && flag_unsafe_math_optimizations)
> > > ! || (INTEGRAL_TYPE_P (type) && TYPE_OVERFLOW_WRAPS (type)))
> >
> > Wow, yuck. I guess it has to be done, though.
> >
> > It would be cool if we could later use VRP to do the association when
> > permitted.
>
> This is what I ended up with. We can keep reassociation for a few
> cases, like (a + 5) + 10, reassociating to a + (5 + 10) or even
> (1 - a) + a to (a - a) + 1. This way the testcase of PR30364 still
> is fixed and no regressions appear otherwise.
>
> Bootstrapped and tested on x86_64-unknown-linux-gnu. Does this look
> right?
This looks right to me.
Thanks.
Ian