This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/19905] New: Extra V_MAY_DEF on a static variable whose address is not taken (we should be able to move the load out of the loop)
- 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: 11 Feb 2005 14:47:16 -0000
- Subject: [Bug tree-optimization/19905] New: Extra V_MAY_DEF on a static variable whose address is not taken (we should be able to move the load out of the loop)
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The following two functions should be the same (note don't compile with -ffast-math or even -fno-
math-errno as sqrt is marked as pure)
#define NUMPOINTS 20
float opoints[NUMPOINTS];
double sqrt (double);
void NormalizeVectors (void)
{
int i, r;
float s, x, y, z;
static float d = 0.0;
d += 0.2f;
if (d > 4)
d = 0.0;
for (i=0; i<NUMPOINTS; i++)
{
opoints[i] = sqrt (d);
}
}
void NormalizeVectors1 (void)
{
int i, r;
float s, x, y, z;
static float d = 0.0;
d += 0.2f;
if (d > 4)
d = 0.0;
s = d;
for (i=0; i<NUMPOINTS; i++)
{
opoints[i] = sqrt (s);
}
}
--
Summary: Extra V_MAY_DEF on a static variable whose address is
not taken (we should be able to move the load out of the
loop)
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: enhancement
Priority: P2
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pinskia at gcc dot gnu dot org
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19905