[Bug middle-end/58956] [4.7/4.8/4.9 Regression] wrong code at -O1 and above (affecting gcc 4.6 to trunk)
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Nov 19 11:09:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58956
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
Well, on GIMPLE all is ok
<bb 2>:
i_2 = c;
*i_2 = foo ();
but we expand it like
;; *i_2 = foo (); --- note, TER applies!
(insn 5 4 6 (set (reg:QI 0 ax)
(const_int 0 [0])) t.i:26 -1
(nil))
(call_insn 6 5 7 (set (reg:SI 0 ax)
(call (mem:QI (symbol_ref:DI ("foo") [flags 0x3] <function_decl
0x7f2ae1c46200 foo>) [0 foo S1 A8])
(const_int 0 [0]))) t.i:26 -1
(expr_list:REG_EH_REGION (const_int 0 [0])
(nil))
(expr_list:REG_DEP_TRUE (use (reg:QI 0 ax))
(nil)))
(insn 7 6 8 (set (reg:SI 90)
(reg:SI 0 ax)) t.i:26 -1
(nil))
(insn 8 7 9 (set (reg:SI 91)
(reg:SI 90)) t.i:26 -1
(insn 9 8 10 (set (reg/f:DI 92)
(mem/f/c:DI (symbol_ref:DI ("c") [flags 0x2] <var_decl 0x7f2ae1c48260
c>) [0 c+0 S8 A64])) t.i:26 -1
(nil))
(insn 10 9 0 (set (mem:SI (reg/f:DI 92) [0 *i_2+0 S4 A32])
(reg:SI 91)) t.i:26 -1
(nil))
So indeed expand sees wrong IL - *c = foo () here. I have a patch.
More information about the Gcc-bugs
mailing list