public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/49941] New: segmentation fault in redirect_jump_2
@ 2011-08-02  7:42 amodra at gmail dot com
  2011-08-02  9:39 ` [Bug rtl-optimization/49941] [4.7 Regression] " rguenth at gcc dot gnu.org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: amodra at gmail dot com @ 2011-08-02  7:42 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49941

           Summary: segmentation fault in redirect_jump_2
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: amodra@gmail.com


spawn /home/amodra/build/gcc-curr/gcc/xgcc -B/home/amodra/build/gcc-curr/gcc/
/home/amodra/src/gcc-current/gcc/testsuite/gcc.dg/fold-compare-3.c -O2
-fdump-tree-cfg -S -m32 -o fold-compare-3.s
/home/amodra/src/gcc-current/gcc/testsuite/gcc.dg/fold-compare-3.c: In function
'bla4eq':
/home/amodra/src/gcc-current/gcc/testsuite/gcc.dg/fold-compare-3.c:32:1:
internal compiler error: Segmentation fault

#0  redirect_jump_2 (jump=0xf70c5100, olabel=0x0, nlabel=0x0, delete_unused=0,
invert=1) at /home/amodra/src/gcc-current/gcc/jump.c:1515
#1  0x103f74a8 in invert_jump (jump=0xf70c5100, nlabel=0x0, delete_unused=0) at
/home/amodra/src/gcc-current/gcc/jump.c:1614
#2  0x101bd4b0 in set_edge_can_fallthru_flag () at
/home/amodra/src/gcc-current/gcc/cfganal.c:270
#3  0x10876968 in reorder_basic_blocks () at
/home/amodra/src/gcc-current/gcc/bb-reorder.c:1917
#4  0x10878828 in rest_of_handle_reorder_blocks () at
/home/amodra/src/gcc-current/gcc/bb-reorder.c:2320


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug rtl-optimization/49941] [4.7 Regression] segmentation fault in redirect_jump_2
  2011-08-02  7:42 [Bug rtl-optimization/49941] New: segmentation fault in redirect_jump_2 amodra at gmail dot com
@ 2011-08-02  9:39 ` rguenth at gcc dot gnu.org
  2011-08-02 14:50 ` rguenth at gcc dot gnu.org
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-08-02  9:39 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49941

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rth at gcc dot gnu.org
   Target Milestone|---                         |4.7.0
            Summary|segmentation fault in       |[4.7 Regression]
                   |redirect_jump_2             |segmentation fault in
                   |                            |redirect_jump_2


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug rtl-optimization/49941] [4.7 Regression] segmentation fault in redirect_jump_2
  2011-08-02  7:42 [Bug rtl-optimization/49941] New: segmentation fault in redirect_jump_2 amodra at gmail dot com
  2011-08-02  9:39 ` [Bug rtl-optimization/49941] [4.7 Regression] " rguenth at gcc dot gnu.org
@ 2011-08-02 14:50 ` rguenth at gcc dot gnu.org
  2011-08-02 15:14 ` amodra at gmail dot com
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-08-02 14:50 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49941

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug rtl-optimization/49941] [4.7 Regression] segmentation fault in redirect_jump_2
  2011-08-02  7:42 [Bug rtl-optimization/49941] New: segmentation fault in redirect_jump_2 amodra at gmail dot com
  2011-08-02  9:39 ` [Bug rtl-optimization/49941] [4.7 Regression] " rguenth at gcc dot gnu.org
  2011-08-02 14:50 ` rguenth at gcc dot gnu.org
@ 2011-08-02 15:14 ` amodra at gmail dot com
  2011-08-02 15:30 ` amodra at gmail dot com
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: amodra at gmail dot com @ 2011-08-02 15:14 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49941

Alan Modra <amodra at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P3
   Target Milestone|4.7.0                       |---

--- Comment #1 from Alan Modra <amodra at gmail dot com> 2011-08-02 15:14:01 UTC ---
This is the jump from fold-compare-3.c.198r.pro_and_epilogue
(jump_insn 8 7 9 2 (set (pc)
        (if_then_else (ne (reg:CC 75 7 [122])
                (const_int 0 [0]))
            (return)
            (pc)))
/home/amodra/src/gcc-current/gcc/testsuite/gcc.dg/fold-compare-3.c:30 662
{*rs6000.md:15325}
     (expr_list:REG_BR_PROB (const_int 8010 [0x1f4a])
        (nil))
 -> return)
 ^^^^^^^^^--- and it has its label.

The label disappears in fold-compare-3.c.201r.peephole2
(jump_insn 26 25 9 2 (set (pc)
        (if_then_else (ne (reg:CC 75 7 [122])
                (const_int 0 [0]))
            (return)
            (pc)))
/home/amodra/src/gcc-current/gcc/testsuite/gcc.dg/fold-compare-3.c:30 -1
     (nil))

Last define_peephole2 in rs6000.md is involved here.


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug rtl-optimization/49941] [4.7 Regression] segmentation fault in redirect_jump_2
  2011-08-02  7:42 [Bug rtl-optimization/49941] New: segmentation fault in redirect_jump_2 amodra at gmail dot com
                   ` (2 preceding siblings ...)
  2011-08-02 15:14 ` amodra at gmail dot com
@ 2011-08-02 15:30 ` amodra at gmail dot com
  2011-08-03  0:07 ` bernds at gcc dot gnu.org
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: amodra at gmail dot com @ 2011-08-02 15:30 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49941

--- Comment #2 from Alan Modra <amodra at gmail dot com> 2011-08-02 15:29:57 UTC ---
So, rebuild_jump_labels doesn't add back this JUMP_LABEL, because
mark_jump_label does as its comment says:
   If INSN is a JUMP_INSN and there is at least one
   CODE_LABEL referenced in INSN as a jump target, then store the last
   one in JUMP_LABEL (INSN).

and we have ret_rtx here in the JUMP_LABEL, not a CODE_LABEL.


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug rtl-optimization/49941] [4.7 Regression] segmentation fault in redirect_jump_2
  2011-08-02  7:42 [Bug rtl-optimization/49941] New: segmentation fault in redirect_jump_2 amodra at gmail dot com
                   ` (3 preceding siblings ...)
  2011-08-02 15:30 ` amodra at gmail dot com
@ 2011-08-03  0:07 ` bernds at gcc dot gnu.org
  2011-08-03  0:08 ` bernds at gcc dot gnu.org
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: bernds at gcc dot gnu.org @ 2011-08-03  0:07 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49941

Bernd Schmidt <bernds at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bernds at gcc dot gnu.org

--- Comment #4 from Bernd Schmidt <bernds at gcc dot gnu.org> 2011-08-03 00:05:22 UTC ---
Sorry, wrong version - remove the SIMPLE_RETURN case.


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug rtl-optimization/49941] [4.7 Regression] segmentation fault in redirect_jump_2
  2011-08-02  7:42 [Bug rtl-optimization/49941] New: segmentation fault in redirect_jump_2 amodra at gmail dot com
                   ` (4 preceding siblings ...)
  2011-08-03  0:07 ` bernds at gcc dot gnu.org
@ 2011-08-03  0:08 ` bernds at gcc dot gnu.org
  2011-08-03  1:31 ` amodra at gmail dot com
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: bernds at gcc dot gnu.org @ 2011-08-03  0:08 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49941

--- Comment #3 from Bernd Schmidt <bernds at gcc dot gnu.org> 2011-08-03 00:04:55 UTC ---
Created attachment 24898
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24898
Test patch

Please try this. If it doesn't work, please attach a preprocessed testcase.


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug rtl-optimization/49941] [4.7 Regression] segmentation fault in redirect_jump_2
  2011-08-02  7:42 [Bug rtl-optimization/49941] New: segmentation fault in redirect_jump_2 amodra at gmail dot com
                   ` (5 preceding siblings ...)
  2011-08-03  0:08 ` bernds at gcc dot gnu.org
@ 2011-08-03  1:31 ` amodra at gmail dot com
  2011-08-03  2:44 ` amodra at gmail dot com
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: amodra at gmail dot com @ 2011-08-03  1:31 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49941

--- Comment #5 from Alan Modra <amodra at gmail dot com> 2011-08-03 01:29:54 UTC ---
Bernd, that looks very similar to the patch I started to write.  Then I saw the
comment in mark_jump_label_1
        /* Do not change a previous setting of JUMP_LABEL.  If the
           JUMP_LABEL slot is occupied by a different label,
           create a note for this label.  */

So I'm a little concerned that plugging in ret_rtx like that is safe.  Hmm, I
suppose it is if you know for sure that any jump that returns doesn't reference
other labels.  Is that the case?

I have a patch that handles the JUMP_LABEL replacement in rs6000.md


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug rtl-optimization/49941] [4.7 Regression] segmentation fault in redirect_jump_2
  2011-08-02  7:42 [Bug rtl-optimization/49941] New: segmentation fault in redirect_jump_2 amodra at gmail dot com
                   ` (6 preceding siblings ...)
  2011-08-03  1:31 ` amodra at gmail dot com
@ 2011-08-03  2:44 ` amodra at gmail dot com
  2011-08-03  3:08 ` amodra at gmail dot com
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: amodra at gmail dot com @ 2011-08-03  2:44 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49941

--- Comment #6 from Alan Modra <amodra at gmail dot com> 2011-08-03 02:43:18 UTC ---
Bernd, with your patch applied, bootstrap dies here:

In file included from
/home/amodra/src/gcc-virgin/libgcc/../libdecnumber/decQuad.c:140:0:
/home/amodra/src/gcc-virgin/libgcc/../libdecnumber/decBasic.c: In function
'decNumCompare':
/home/amodra/src/gcc-virgin/libgcc/../libdecnumber/decBasic.c:3773:3: internal
compiler error: Segmentation fault

(gdb) bt
#0  active_insn_p (insn=0x1b0000) at
/home/amodra/src/gcc-virgin/gcc/emit-rtl.c:3258
#1  0x1026b114 in next_active_insn (insn=0x1b0000) at
/home/amodra/src/gcc-virgin/gcc/emit-rtl.c:3271
#2  0x104e3ba4 in tablejump_p (insn=<value optimized out>, labelp=0x0,
tablep=0x10dd9ca8) at /home/amodra/src/gcc-virgin/gcc/rtlanal.c:2667
#3  0x1022bb5c in scan_trace (trace=<value optimized out>) at
/home/amodra/src/gcc-virgin/gcc/dwarf2cfi.c:2586
#4  0x1022c374 in create_cfi_notes () at
/home/amodra/src/gcc-virgin/gcc/dwarf2cfi.c:2621
#5  execute_dwarf2_frame () at /home/amodra/src/gcc-virgin/gcc/dwarf2cfi.c:2953

(gdb) p debug_rtx(insn)
(jump_insn 1695 1694 1698 (parallel [
            (return)
            (use (reg:DI 65 lr))
        ]) /home/amodra/src/gcc-virgin/libgcc/../libdecnumber/decBasic.c:3773
708 {*return_internal_di}
     (nil)
 -> return)
$4 = void
(gdb) p default_target_rtl.x_global_rtl[2]
$5 = (rtx) 0xf70200c0
(gdb) down
#2  0x104e3ba4 in tablejump_p (insn=<value optimized out>, labelp=0x0,
tablep=0x10dd9ca8) at /home/amodra/src/gcc-virgin/gcc/rtlanal.c:2667
(gdb) p label
$6 = (struct rtx_def *) 0xf7029f40
(gdb) p debug_rtx(label)
(return)
$7 = void
(gdb) p debug_rtx(default_target_rtl.x_global_rtl[2])
(return)
$8 = void
(gdb) 

So it appears we have another problem lurking here.


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug rtl-optimization/49941] [4.7 Regression] segmentation fault in redirect_jump_2
  2011-08-02  7:42 [Bug rtl-optimization/49941] New: segmentation fault in redirect_jump_2 amodra at gmail dot com
                   ` (7 preceding siblings ...)
  2011-08-03  2:44 ` amodra at gmail dot com
@ 2011-08-03  3:08 ` amodra at gmail dot com
  2011-08-03 10:45 ` amodra at gmail dot com
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: amodra at gmail dot com @ 2011-08-03  3:08 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49941

--- Comment #7 from Alan Modra <amodra at gmail dot com> 2011-08-03 03:07:13 UTC ---
The lurking problem being that copy_rtx_if_shared_1 needs to leave RETURN
shared, and I guess mark_used_flags doesn't need to do anything with RETURN
too.


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug rtl-optimization/49941] [4.7 Regression] segmentation fault in redirect_jump_2
  2011-08-02  7:42 [Bug rtl-optimization/49941] New: segmentation fault in redirect_jump_2 amodra at gmail dot com
                   ` (8 preceding siblings ...)
  2011-08-03  3:08 ` amodra at gmail dot com
@ 2011-08-03 10:45 ` amodra at gmail dot com
  2011-08-03 11:49 ` amodra at gcc dot gnu.org
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: amodra at gmail dot com @ 2011-08-03 10:45 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49941

Alan Modra <amodra at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code, patch
             Status|UNCONFIRMED                 |ASSIGNED
                URL|                            |http://gcc.gnu.org/ml/gcc-p
                   |                            |atches/2011-08/msg00290.htm
                   |                            |l
   Last reconfirmed|                            |2011.08.03 10:44:10
                 CC|bernds at codesourcery dot  |
                   |com                         |
         AssignedTo|unassigned at gcc dot       |amodra at gmail dot com
                   |gnu.org                     |
     Ever Confirmed|0                           |1


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug rtl-optimization/49941] [4.7 Regression] segmentation fault in redirect_jump_2
  2011-08-02  7:42 [Bug rtl-optimization/49941] New: segmentation fault in redirect_jump_2 amodra at gmail dot com
                   ` (9 preceding siblings ...)
  2011-08-03 10:45 ` amodra at gmail dot com
@ 2011-08-03 11:49 ` amodra at gcc dot gnu.org
  2011-08-03 11:50 ` amodra at gmail dot com
  2011-10-15 10:33 ` amodra at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: amodra at gcc dot gnu.org @ 2011-08-03 11:49 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49941

--- Comment #8 from Alan Modra <amodra at gcc dot gnu.org> 2011-08-03 11:48:24 UTC ---
Author: amodra
Date: Wed Aug  3 11:48:21 2011
New Revision: 177268

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=177268
Log:
    PR rtl-optimization/49941
    * jump.c (mark_jump_label): Comment.
    (mark_jump_label_1): Set JUMP_LABEL for return jumps.
    * emit-rtl.c (copy_rtx_if_shared_1, copy_insn_1): Leave RETURN shared.
    (mark_used_flags): Don't mark RETURN.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/emit-rtl.c
    trunk/gcc/jump.c


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug rtl-optimization/49941] [4.7 Regression] segmentation fault in redirect_jump_2
  2011-08-02  7:42 [Bug rtl-optimization/49941] New: segmentation fault in redirect_jump_2 amodra at gmail dot com
                   ` (10 preceding siblings ...)
  2011-08-03 11:49 ` amodra at gcc dot gnu.org
@ 2011-08-03 11:50 ` amodra at gmail dot com
  2011-10-15 10:33 ` amodra at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: amodra at gmail dot com @ 2011-08-03 11:50 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49941

Alan Modra <amodra at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

--- Comment #9 from Alan Modra <amodra at gmail dot com> 2011-08-03 11:50:07 UTC ---
Fixed


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug rtl-optimization/49941] [4.7 Regression] segmentation fault in redirect_jump_2
  2011-08-02  7:42 [Bug rtl-optimization/49941] New: segmentation fault in redirect_jump_2 amodra at gmail dot com
                   ` (11 preceding siblings ...)
  2011-08-03 11:50 ` amodra at gmail dot com
@ 2011-10-15 10:33 ` amodra at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: amodra at gcc dot gnu.org @ 2011-10-15 10:33 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49941

--- Comment #10 from Alan Modra <amodra at gcc dot gnu.org> 2011-10-15 10:32:36 UTC ---
Author: amodra
Date: Sat Oct 15 10:32:33 2011
New Revision: 180027

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=180027
Log:
    PR rtl-optimization/49941
    * jump.c (mark_jump_label_1): Set JUMP_LABEL for simple_return jumps.

    * rtl.h (set_return_jump_label): Declare.
    * function.c (set_return_jump_label): New function, extracted..
    (thread_prologue_and_epilogue_insns): ..from here.  Use it in
    another instance to set return jump_label.
    * cfgrtl.c (force_nonfallthru_and_redirect): Use set_return_jump_label.
    * reorg.c (find_end_label): Likewise.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/cfgrtl.c
    trunk/gcc/function.c
    trunk/gcc/jump.c
    trunk/gcc/reorg.c
    trunk/gcc/rtl.h


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2011-10-15 10:33 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-02  7:42 [Bug rtl-optimization/49941] New: segmentation fault in redirect_jump_2 amodra at gmail dot com
2011-08-02  9:39 ` [Bug rtl-optimization/49941] [4.7 Regression] " rguenth at gcc dot gnu.org
2011-08-02 14:50 ` rguenth at gcc dot gnu.org
2011-08-02 15:14 ` amodra at gmail dot com
2011-08-02 15:30 ` amodra at gmail dot com
2011-08-03  0:07 ` bernds at gcc dot gnu.org
2011-08-03  0:08 ` bernds at gcc dot gnu.org
2011-08-03  1:31 ` amodra at gmail dot com
2011-08-03  2:44 ` amodra at gmail dot com
2011-08-03  3:08 ` amodra at gmail dot com
2011-08-03 10:45 ` amodra at gmail dot com
2011-08-03 11:49 ` amodra at gcc dot gnu.org
2011-08-03 11:50 ` amodra at gmail dot com
2011-10-15 10:33 ` amodra at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).