public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/18861] [4.0 Regression] ICE Segmentation fault in try_crossjump_to_edge at ../../gcc/gcc/cfgcleanup.c:1637 with two switches (table jumps)
       [not found] <20041206224132.18861.belyshev@depni.sinp.msu.ru>
@ 2005-01-05 12:21 ` jakub at gcc dot gnu dot org
  2005-01-05 17:40 ` reichelt at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu dot org @ 2005-01-05 12:21 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From jakub at gcc dot gnu dot org  2005-01-05 12:20 -------
Yeah, looks like a latent bug.
I'd say the problem is incorrect cfg after conversion from gimple to rtl,
particularly that basic blocks that end with a tablejump have extra edges
to bb's with abort (), but the tablejump can't jump to it:
Basic block 1 prev 0, next 2, loop_depth 0, count 0, freq 5000, maybe hot.
Predecessors:  0 [50.0%]  (fallthru)
Successors:  3 [50.0%]  2 [50.0%]  (fallthru)

Basic block 2 prev 1, next 3, loop_depth 0, count 0, freq 2500, maybe hot.
Predecessors:  1 [50.0%]  (fallthru)
Successors:  7 [14.3%]  8 [14.3%]  9 [14.3%]  10 [14.3%]  11 [14.3%]  12 [14.3%] 
3 [14.3%]

(jump_insn 19 18 94 1 (set (pc)
        (if_then_else (gtu (reg:CC 17 flags)
                (const_int 0 [0x0]))
            (label_ref 27)
            (pc))) 337 {*jcc_1} (nil)
    (expr_list:REG_BR_PROB (const_int 5000 [0x1388])
        (nil)))
;; End of basic block 1, registers live:
 (nil)

;; Start of basic block 2, registers live: (nil)
(note 94 19 21 2 [bb 2] NOTE_INSN_BASIC_BLOCK)

(insn 21 94 22 2 (set (reg:SI 63)
        (mem/u/c:SI (plus:SI (mult:SI (reg:SI 61)
                    (const_int 4 [0x4]))
                (label_ref:SI 24)) [0 S4 A8])) 35 {*movsi_1} (nil)
    (insn_list:REG_LABEL 24 (nil)))

(jump_insn 22 21 23 2 (parallel [
            (set (pc)
                (reg:SI 63))
            (use (label_ref 24))
        ]) 353 {*tablejump_1} (nil)
    (nil))
;; End of basic block 2, registers live:
 (nil)

(barrier 23 22 24)

;; Insn is not within a basic block
(code_label 24 23 25 11 "" [2 uses])

;; Insn is not within a basic block
(jump_insn 25 24 26 (addr_vec:SI [
            (label_ref:SI 50)
            (label_ref:SI 55)
            (label_ref:SI 60)
            (label_ref:SI 65)
            (label_ref:SI 70)
            (label_ref:SI 75)
        ]) -1 (nil)
    (nil))

(barrier 26 25 27)

;; Start of basic block 3, registers live: (nil)
(code_label 27 26 28 3 4 "" [1 uses])

(note 28 27 30 3 [bb 3] NOTE_INSN_BASIC_BLOCK)

(call_insn 30 28 31 3 (call (mem:QI (symbol_ref:SI ("abort") [flags 0x41]
<function_decl 0xf7d1fca8 abort>) [0 S1 A8])
        (const_int 0 [0x0])) -1 (nil)
    (expr_list:REG_NORETURN (const_int 0 [0x0])
        (expr_list:REG_EH_REGION (const_int 0 [0x0])
            (nil)))
    (nil))
;; End of basic block 3, registers live:
 (nil)

(barrier 31 30 32)

The bb with abort is a successor at tree level of the switch bb, but when that
bb is split into a conditional jump to the abort bb and tablejump, apparently
the edge is not removed.
-floop-optimize2 is needed for this because the old loop optimizer calls
find_basic_blocks, i.e. recreates all basic blocks from scratch and the recreated
edges are correct.
Do you agree?

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jakub at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2004-12-06 23:07:59         |2005-01-05 12:20:33
               date|                            |


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


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

* [Bug rtl-optimization/18861] [4.0 Regression] ICE Segmentation fault in try_crossjump_to_edge at ../../gcc/gcc/cfgcleanup.c:1637 with two switches (table jumps)
       [not found] <20041206224132.18861.belyshev@depni.sinp.msu.ru>
  2005-01-05 12:21 ` [Bug rtl-optimization/18861] [4.0 Regression] ICE Segmentation fault in try_crossjump_to_edge at ../../gcc/gcc/cfgcleanup.c:1637 with two switches (table jumps) jakub at gcc dot gnu dot org
@ 2005-01-05 17:40 ` reichelt at gcc dot gnu dot org
  2005-01-05 18:18 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2005-01-05 17:40 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From reichelt at gcc dot gnu dot org  2005-01-05 17:40 -------
Here's an even shorter testcase.
Note that it uses 5 case labels with 3 returns - just as in PR18628.
So maybe these two are related.

==============================
int foo(int i)
{
  if (i >= 0)
  {
    switch (i)
      {
        case 0: return 0;
        case 1:
        case 2: return 1;
        case 3:
        case 4: return 2;
      }
  }
  switch (i)
    {
      case 0: return 0;
      case 1:
      case 2: return 1;
      case 3:
      case 4: return 2;
    }
}
==============================


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |reichelt at gcc dot gnu dot
                   |                            |org
           Keywords|                            |monitored


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


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

* [Bug rtl-optimization/18861] [4.0 Regression] ICE Segmentation fault in try_crossjump_to_edge at ../../gcc/gcc/cfgcleanup.c:1637 with two switches (table jumps)
       [not found] <20041206224132.18861.belyshev@depni.sinp.msu.ru>
  2005-01-05 12:21 ` [Bug rtl-optimization/18861] [4.0 Regression] ICE Segmentation fault in try_crossjump_to_edge at ../../gcc/gcc/cfgcleanup.c:1637 with two switches (table jumps) jakub at gcc dot gnu dot org
  2005-01-05 17:40 ` reichelt at gcc dot gnu dot org
@ 2005-01-05 18:18 ` pinskia at gcc dot gnu dot org
  2005-01-07  9:04 ` cvs-commit at gcc dot gnu dot org
  2005-01-07 12:12 ` belyshev at depni dot sinp dot msu dot ru
  4 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-05 18:18 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-01-05 18:18 -------
Patch here: <http://gcc.gnu.org/ml/gcc-patches/2005-01/msg00286.html>.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


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


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

* [Bug rtl-optimization/18861] [4.0 Regression] ICE Segmentation fault in try_crossjump_to_edge at ../../gcc/gcc/cfgcleanup.c:1637 with two switches (table jumps)
       [not found] <20041206224132.18861.belyshev@depni.sinp.msu.ru>
                   ` (2 preceding siblings ...)
  2005-01-05 18:18 ` pinskia at gcc dot gnu dot org
@ 2005-01-07  9:04 ` cvs-commit at gcc dot gnu dot org
  2005-01-07 12:12 ` belyshev at depni dot sinp dot msu dot ru
  4 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-01-07  9:04 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-01-07 09:04 -------
Subject: Bug 18861

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	jakub@gcc.gnu.org	2005-01-07 09:04:02

Modified files:
	gcc            : ChangeLog cfgbuild.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gcc.dg: 20050105-1.c 

Log message:
	PR rtl-optimization/18861
	* cfgbuild.c (BLOCK_USED_BY_TABLEJUMP): Define.
	(FULL_STATE): Define.
	(mark_tablejump_edge): New function.
	(purge_dead_tablejump_edges): New function.
	(find_bb_boundaries): Use it.
	
	* gcc.dg/20050105-1.c: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.7055&r2=2.7056
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cfgbuild.c.diff?cvsroot=gcc&r1=1.57&r2=1.58
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4861&r2=1.4862
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/20050105-1.c.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


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


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

* [Bug rtl-optimization/18861] [4.0 Regression] ICE Segmentation fault in try_crossjump_to_edge at ../../gcc/gcc/cfgcleanup.c:1637 with two switches (table jumps)
       [not found] <20041206224132.18861.belyshev@depni.sinp.msu.ru>
                   ` (3 preceding siblings ...)
  2005-01-07  9:04 ` cvs-commit at gcc dot gnu dot org
@ 2005-01-07 12:12 ` belyshev at depni dot sinp dot msu dot ru
  4 siblings, 0 replies; 8+ messages in thread
From: belyshev at depni dot sinp dot msu dot ru @ 2005-01-07 12:12 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From belyshev at depni dot sinp dot msu dot ru  2005-01-07 12:12 -------
Fixed.

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


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


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

* [Bug rtl-optimization/18861] [4.0 Regression] ICE Segmentation fault in try_crossjump_to_edge at ../../gcc/gcc/cfgcleanup.c:1637 with two switches (table jumps)
  2004-12-06 22:41 [Bug middle-end/18861] New: [4.0 Regression] ICE Segmentation fault in try_crossjump_to_edge at ../../gcc/gcc/cfgcleanup.c:1637 belyshev at lubercy dot com
  2004-12-08  0:18 ` [Bug rtl-optimization/18861] [4.0 Regression] ICE Segmentation fault in try_crossjump_to_edge at ../../gcc/gcc/cfgcleanup.c:1637 with two switches (table jumps) steven at gcc dot gnu dot org
  2004-12-12  5:55 ` kazu at cs dot umass dot edu
@ 2004-12-12 10:04 ` steven at gcc dot gnu dot org
  2 siblings, 0 replies; 8+ messages in thread
From: steven at gcc dot gnu dot org @ 2004-12-12 10:04 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From steven at gcc dot gnu dot org  2004-12-12 10:04 -------
Since the bug is at the RTL level and amacleod's patch only changes things 
at the tree level, that patch probably just uncovered a latent bug. 

-- 


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


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

* [Bug rtl-optimization/18861] [4.0 Regression] ICE Segmentation fault in try_crossjump_to_edge at ../../gcc/gcc/cfgcleanup.c:1637 with two switches (table jumps)
  2004-12-06 22:41 [Bug middle-end/18861] New: [4.0 Regression] ICE Segmentation fault in try_crossjump_to_edge at ../../gcc/gcc/cfgcleanup.c:1637 belyshev at lubercy dot com
  2004-12-08  0:18 ` [Bug rtl-optimization/18861] [4.0 Regression] ICE Segmentation fault in try_crossjump_to_edge at ../../gcc/gcc/cfgcleanup.c:1637 with two switches (table jumps) steven at gcc dot gnu dot org
@ 2004-12-12  5:55 ` kazu at cs dot umass dot edu
  2004-12-12 10:04 ` steven at gcc dot gnu dot org
  2 siblings, 0 replies; 8+ messages in thread
From: kazu at cs dot umass dot edu @ 2004-12-12  5:55 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From kazu at cs dot umass dot edu  2004-12-12 05:55 -------
My binary search converges between "2004-11-02 00:20GMT"
and "2004-11-02 00:25GMT".

The following patch has either caused the bug or exposed a latent bug.

Adding Andrew MacLeod to CC.

2004-11-01  Andrew MacLeod  <amacleod@redhat.com>

	PR tree-optimization/16447
	* tree-cfg.c (bsi_commit_one_edge_insert): Rename from
	bsi_commit_edge_inserts_1, and make funtion external.  Return new block.
	(bsi_commit_edge_inserts): Use renamed bsi_commit_one_edge_insert.
	* tree-optimize.c (pass_cleanup_cfg_post_optimizing): Enable listing.
	* tree-flow.h (bsi_commit_one_edge_insert): Extern decl.
	* tree-outof-ssa.c (rewrite_trees): Don't commit edges here.
	(same_stmt_list_p): New.  Return TRUE if edge is to be forwarded.
	(identical_copies_p): New.  Return true is two copies are the same.
	(identical_stmt_lists_p): New.  Return true if stmt lists are the same.
	(analyze_edges_for_bb): New.  Determine how best to insert edge stmts
	for a basic block.
	(perform_edge_inserts): New.  Determine what to do with all stmts that
	have been inserted on edges.
	(remove_ssa_form):  Analyze and commit edges from here.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |amacleod at redhat dot com


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


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

* [Bug rtl-optimization/18861] [4.0 Regression] ICE Segmentation fault in try_crossjump_to_edge at ../../gcc/gcc/cfgcleanup.c:1637 with two switches (table jumps)
  2004-12-06 22:41 [Bug middle-end/18861] New: [4.0 Regression] ICE Segmentation fault in try_crossjump_to_edge at ../../gcc/gcc/cfgcleanup.c:1637 belyshev at lubercy dot com
@ 2004-12-08  0:18 ` steven at gcc dot gnu dot org
  2004-12-12  5:55 ` kazu at cs dot umass dot edu
  2004-12-12 10:04 ` steven at gcc dot gnu dot org
  2 siblings, 0 replies; 8+ messages in thread
From: steven at gcc dot gnu dot org @ 2004-12-08  0:18 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From steven at gcc dot gnu dot org  2004-12-08 00:18 -------
"-O2 -floop-optimize2" is enough for the test case in comment 2. 

-- 


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


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

end of thread, other threads:[~2005-01-07 12:12 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20041206224132.18861.belyshev@depni.sinp.msu.ru>
2005-01-05 12:21 ` [Bug rtl-optimization/18861] [4.0 Regression] ICE Segmentation fault in try_crossjump_to_edge at ../../gcc/gcc/cfgcleanup.c:1637 with two switches (table jumps) jakub at gcc dot gnu dot org
2005-01-05 17:40 ` reichelt at gcc dot gnu dot org
2005-01-05 18:18 ` pinskia at gcc dot gnu dot org
2005-01-07  9:04 ` cvs-commit at gcc dot gnu dot org
2005-01-07 12:12 ` belyshev at depni dot sinp dot msu dot ru
2004-12-06 22:41 [Bug middle-end/18861] New: [4.0 Regression] ICE Segmentation fault in try_crossjump_to_edge at ../../gcc/gcc/cfgcleanup.c:1637 belyshev at lubercy dot com
2004-12-08  0:18 ` [Bug rtl-optimization/18861] [4.0 Regression] ICE Segmentation fault in try_crossjump_to_edge at ../../gcc/gcc/cfgcleanup.c:1637 with two switches (table jumps) steven at gcc dot gnu dot org
2004-12-12  5:55 ` kazu at cs dot umass dot edu
2004-12-12 10:04 ` steven at gcc dot gnu dot 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).