------- 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