This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/38609] [4.4 Regression]: gcc.c-torture/execute/built-in-setjmp.c execute -O2 and above
- From: "jakub at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 23 Dec 2008 18:14:55 -0000
- Subject: [Bug middle-end/38609] [4.4 Regression]: gcc.c-torture/execute/built-in-setjmp.c execute -O2 and above
- References: <bug-38609-507@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #1 from jakub at gcc dot gnu dot org 2008-12-23 18:14 -------
The only change my patch does are two successful replace_read calls in DSE,
nothing else changed, and those 2 replacements look correct to me.
In *.optimized we have:
<bb 2>:
D.1233 = __builtin_alloca (20);
<bb 3>:
p = (char *) D.1233;
__builtin_memcpy (p, &"test"[0], 5);
<bb 4>:
__builtin_setjmp_setup (&buf, &<L0>);
goto <bb 6>;
<L0>:
__builtin_setjmp_receiver (&<L0>);
goto <bb 14>;
<bb 6>:
D.1240 = p + 2;
D.1244 = __builtin_alloca ((long unsigned int) *D.1240 * 4);
goto <bb 9>;
<bb 7>:
abort ();
<bb 8>:
exit (0);
<bb 9>:
if (*D.1240 > 0)
goto <bb 15>;
else
goto <bb 11>;
and what DSE now can do and could not do, is replace the two *D.1240 reads
with 0x73, as p[2] is known to contain 's' and nothing else could have changed
it.
In *.cse2 we have:
(insn 35 34 36 2 B2.c:19 (set (mem:SI (reg/f:SI 14 sp) [0 S4 A8])
(reg:SI 57)) 38 {*movsi_internal} (expr_list:REG_EQUAL (const_int
1953719668 [0x74736574])
(nil)))
(insn 36 35 38 2 B2.c:19 (set (mem:QI (plus:SI (reg/f:SI 14 sp)
(const_int 4 [0x4])) [0 S1 A8])
(const_int 0 [0x0])) 47 {movqi} (nil))
... # no sp related stores
(insn 56 42 57 2 B2.c:30 (set (reg/f:SI 52 [ D.1240 ])
(plus:SI (reg/f:SI 14 sp)
(const_int 2 [0x2]))) 75 {*addsi3_non_v32} (nil))
(insn 57 56 58 2 B2.c:30 (set (reg:SI 60)
(sign_extend:SI (mem:QI (reg/f:SI 52 [ D.1240 ]) [0 S1 A8]))) 56
{extendqisi2} (nil))
... # no sp related stores
(insn 62 61 65 2 B2.c:30 (set (reg/f:SI 14 sp)
(minus:SI (reg/f:SI 14 sp)
(reg:SI 64))) 83 {*subsi3_non_v32} (nil))
(insn 65 62 79 2 B2.c:30 (set (reg/f:SI 51 [ D.1244 ])
(reg/f:SI 14 sp)) 38 {*movsi_internal} (nil))
(insn 79 65 80 2 B2.c:33 (set (cc0)
(mem:QI (reg/f:SI 52 [ D.1240 ]) [0 S1 A8])) 6 {*tstqi_non_cmp} (nil))
(jump_insn 80 79 45 2 B2.c:33 (set (pc)
(if_then_else (le (cc0)
(const_int 0 [0x0]))
(label_ref 91)
(pc))) 198 {ble} (expr_list:REG_BR_PROB (const_int 900 [0x384])
(nil)))
During DSE1 is:
(insn 145 34 146 2 B2.c:19 (set (reg:QI 76)
(const_int 115 [0x73])) -1 (nil))
(insn 146 145 35 2 B2.c:19 (set (reg:QI 77)
(const_int 115 [0x73])) -1 (nil))
inserted after insn 34, insn 57 becomes:
(insn 57 56 58 2 B2.c:30 (set (reg:SI 60)
(sign_extend:SI (reg:QI 76))) 56 {extendqisi2} (nil))
and insn 79 becomes:
(insn 79 65 80 2 B2.c:33 (set (cc0)
(reg:QI 77)) 6 {*tstqi_non_cmp} (nil))
During combine, the jump_insn 80 is optimized out, as 0x73 is known to be >= 0.
I haven't read the whole RTL till the last phase, so I don't know where things
went wrong, but I'm pretty sure the bug isn't in DSE and the recent changes,
so cris had just some latent bug.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38609