This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/23488] [4.1 Regression] extra reads from static variable
- 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: 19 Aug 2005 22:35:56 -0000
- Subject: [Bug target/23488] [4.1 Regression] extra reads from static variable
- References: <20050819213951.23488.dann@godzilla.ics.uci.edu>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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