This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/19828] [4.0 Regression] LIM is pulling out a pure function even though there is something which can modify global memory
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 8 Feb 2005 20:02:14 -0000
- Subject: [Bug tree-optimization/19828] [4.0 Regression] LIM is pulling out a pure function even though there is something which can modify global memory
- References: <20050208190328.19828.pinskia@gcc.gnu.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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