This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Fix PR rtl-optimization/42461
> > I guess something like
> > float
> > __attribute__ ((noinline,noclobber))
> > const_function (float a, float b)
> > {
> > return a/b;
> > }
> > main()
> > {
> > const_function (1,0);
> > }
> >
> > with non-call exceptions. It does throw but DCE should remove it with this
> > change I believe.
>
> And we didn't before the EH rewrite?
We did, but it is bug IMO.
Here is more refined testcase:
__attribute__ ((noinline, noclone, pure))
int t(int *a)
{
return *a;
}
int *b;
main()
{
t(0);
}
Call to t(0) survives till .optimized dump but then it is removed
by RTL land.
There is some confussion concerning throwing and pure/const, since autodetection
will disqualify the function too.
I would say that pure/const functions can throw (otherwise they would be useless with non-call-exceptions
as they are mostly now) and we should remove them based if we want to preserve the throwing side effect
that is the case of Java (and we traditionaly test non-call-exceptions for that). I am not sure about Ada.
Honza