[Bug target/23488] [4.1 Regression] extra reads from static variable

pinskia at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Fri Aug 19 22:43:00 GMT 2005


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-08-19 22:35 -------
Further reduced testcase:
int
xtermEnvEncoding(void)
{
  static int result;
  if (result == 0)
    result = 2;
  return result;
}

Basicially the issue is that the if is emitted as cmp 0, result instead of what it was before as
set regtmp, result
cmp regtmp, 0
so GCSE/PRE does not see the load.
And yes this is load PRE which means this is most likely be fixed for 4.2 on the tree level.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23488



More information about the Gcc-bugs mailing list