[Bug tree-optimization/19828] [4.0 Regression] LIM is pulling out a pure function even though there is something which can modify global memory
pinskia at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Wed Feb 9 06:43:00 GMT 2005
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-02-08 20:02 -------
(In reply to comment #2)
> Here's another one. This may be a different bug.
Yes that is a different (but related) bug. The problem is now, what is definition of pure functions (for
that testcase).
Take the following:
int *a;
int *func_pure () __attribute__((pure));
int func_pure_2 () __attribute__((pure));
int *func_pure() { return a; }
int func_pure_2() { return *a;}
int i;
int
func_loop_3 (int arg)
{
int var = 0;
i = 1;
while (arg--)
{
if (func_pure ())
var = func_pure_2 ();
}
return var;
}
void abort (void);
int main()
{
int i;
i = func_loop_3 (10);
if (i)
abort ();
}
Is func_pure_2 really pure and if it is, then we should change it so we can trap on it.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19828
More information about the Gcc-bugs
mailing list