[Bug middle-end/38609] [4.4 Regression]: gcc.c-torture/execute/built-in-setjmp.c execute -O2 and above
--- Comment #15 from hp at gcc dot gnu dot org 2009-03-19 04:17 --- Follow-up to 39499. -- hp at gcc dot gnu dot org changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution||FIXED http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38609
[Bug middle-end/38609] [4.4 Regression]: gcc.c-torture/execute/built-in-setjmp.c execute -O2 and above
--- Comment #14 from hp at gcc dot gnu dot org 2009-03-19 03:53 --- Subject: Bug 38609 Author: hp Date: Thu Mar 19 03:52:58 2009 New Revision: 144951 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=144951 Log: PR middle-end/38609 * config/cris/cris.h (FRAME_POINTER_REQUIRED): Force for all functions with dynamic stack-pointer adjustments. Modified: trunk/gcc/ChangeLog trunk/gcc/config/cris/cris.h -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38609
[Bug middle-end/38609] [4.4 Regression]: gcc.c-torture/execute/built-in-setjmp.c execute -O2 and above
--- Comment #13 from hp at gcc dot gnu dot org 2009-03-18 22:29 --- Noticed bug in middle-end (reload1.c:set_label_offsets) changing to middle-end. -- hp at gcc dot gnu dot org changed: What|Removed |Added Component|target |middle-end http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38609
[Bug middle-end/38609] [4.4 Regression]: gcc.c-torture/execute/built-in-setjmp.c execute -O2 and above
--- Comment #6 from dave dot korn dot cygwin at gmail dot com 2009-01-26 09:58 --- Hi HP, (In reply to comment #5) > Glancing at the assembly and simulator trace (no looking at rtl or tree dumps > yet), the value of "p" (sp after the first alloca) is somehow lost and after > the __builtin_longjmp we effectively strcmp (NULL, "test") which FWIW, doesn't > SEGV in the simulator, but nevertheless obviously doesn't match. > At the longjmp-receiver, "p" is retrieved for the strcmp call as "move.d > [$sp+8],$r10", i.e. $r10 = *((char *) $sp + 8), but that's bogus as nothing > was > stored there; "move.d $sp,$r10" (just copying the stack-pointer) would have > been correct. Sounds like this could maybe be a dup of bug 38952, where the frame pointer is incorrectly calculated when setjmp saves it in the jmp_buf, and therefore restored to an incorrect value by longjmp. For a quick test without rebuilding your compiler, see if "-mpreferred-stack-boundary=2" or "-mno-stackrealign" fixes the failure in built-in-setjmp.c; if so there's a patch in the PR that should help. cheers, DaveK -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38609
[Bug middle-end/38609] [4.4 Regression]: gcc.c-torture/execute/built-in-setjmp.c execute -O2 and above
--- Comment #5 from hp at gcc dot gnu dot org 2008-12-31 19:13 --- Glancing at the assembly and simulator trace (no looking at rtl or tree dumps yet), the value of "p" (sp after the first alloca) is somehow lost and after the __builtin_longjmp we effectively strcmp (NULL, "test") which FWIW, doesn't SEGV in the simulator, but nevertheless obviously doesn't match. At the longjmp-receiver, "p" is retrieved for the strcmp call as "move.d [$sp+8],$r10", i.e. $r10 = *((char *) $sp + 8), but that's bogus as nothing was stored there; "move.d $sp,$r10" (just copying the stack-pointer) would have been correct. I'll look further. HNY. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38609
[Bug middle-end/38609] [4.4 Regression]: gcc.c-torture/execute/built-in-setjmp.c execute -O2 and above
-- rguenth at gcc dot gnu dot org changed: What|Removed |Added Priority|P3 |P4 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38609
[Bug middle-end/38609] [4.4 Regression]: gcc.c-torture/execute/built-in-setjmp.c execute -O2 and above
-- hp at gcc dot gnu dot org changed: What|Removed |Added Status|WAITING |NEW Ever Confirmed|0 |1 Last reconfirmed|-00-00 00:00:00 |2008-12-23 22:17:16 date|| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38609
[Bug middle-end/38609] [4.4 Regression]: gcc.c-torture/execute/built-in-setjmp.c execute -O2 and above
--- Comment #4 from hp at gcc dot gnu dot org 2008-12-23 22:12 --- (In reply to comment #3) > I couldn't spot any bug eyeballing the assembly (or final RTL dump), so can > you > please debug how this now fails at runtime (abort, corruption (where), etc.)? "(i.e. calls to abort)" Thanks for looking and for the DSE analysis. I'll have a look before the next year. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38609
[Bug middle-end/38609] [4.4 Regression]: gcc.c-torture/execute/built-in-setjmp.c execute -O2 and above
--- Comment #3 from jakub at gcc dot gnu dot org 2008-12-23 21:52 --- I couldn't spot any bug eyeballing the assembly (or final RTL dump), so can you please debug how this now fails at runtime (abort, corruption (where), etc.)? -- jakub at gcc dot gnu dot org changed: What|Removed |Added Status|UNCONFIRMED |WAITING http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38609
[Bug middle-end/38609] [4.4 Regression]: gcc.c-torture/execute/built-in-setjmp.c execute -O2 and above
--- Comment #2 from hp at gcc dot gnu dot org 2008-12-23 18:30 --- (In reply to comment #1) > 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, It might very well be that your change exposed a bug elsewhere... > so cris had just some latent bug. ...but FWIW in either case, this is a faulty conclusion; there is more code than the back-end. I'll try to point to it, but I hope I can get assistance if the trace points at code you understand. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38609
[Bug middle-end/38609] [4.4 Regression]: gcc.c-torture/execute/built-in-setjmp.c execute -O2 and above
--- 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: : D.1233 = __builtin_alloca (20); : p = (char *) D.1233; __builtin_memcpy (p, &"test"[0], 5); : __builtin_setjmp_setup (&buf, &); goto ; : __builtin_setjmp_receiver (&); goto ; : D.1240 = p + 2; D.1244 = __builtin_alloca ((long unsigned int) *D.1240 * 4); goto ; : abort (); : exit (0); : if (*D.1240 > 0) goto ; else goto ; 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
[Bug middle-end/38609] [4.4 Regression]: gcc.c-torture/execute/built-in-setjmp.c execute -O2 and above
-- pinskia at gcc dot gnu dot org changed: What|Removed |Added CC||pinskia at gcc dot gnu dot ||org Keywords||wrong-code Target Milestone|--- |4.4.0 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38609