public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/45854] New: ICE in redirect_eh_edge_1, at tree-eh.c:2131
@ 2010-10-01  7:25 gcc at abeckmann dot de
  2010-10-01 10:38 ` [Bug middle-end/45854] [4.5 Regression] " rguenth at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: gcc at abeckmann dot de @ 2010-10-01  7:25 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: ICE in redirect_eh_edge_1, at tree-eh.c:2131
           Product: gcc
           Version: 4.5.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: gcc@abeckmann.de


The following code fails in 4.5.2 (but not 4.4.5, 4.3.6 or 4.6.0) in
optimization levels -O2 and -O3:

========== 8< ==========
template < typename = void >
struct X { } ;
struct Y
{
        Y () ;
} ;
template < typename = X < > >
struct T
{
        void f ()
        {
                f () ;
        }
} ;
struct S
{
        S ( X < > = X < > ()) ;
        ~S ()
        {
                T < > () . f () ;
        }
} ;
struct
{
        S s ;
        Y y ;
} a ;
========== >8 ==========

which this error:

_.cpp:28:3: warning: non-local variable ‘<anonymous struct> a’ uses anonymous
type
_.cpp: In constructor ‘<anonymous struct>::._0()’:
_.cpp:28:5: internal compiler error: in redirect_eh_edge_1, at tree-eh.c:2131


$ g++-4.5.x -v -O2 -c ice-redirect_eh_edge_1-tree-eh-c-2131.min.cpp
Using built-in specs.
COLLECT_GCC=/opt/software/x86_64/gcc-4.5.x/bin/g++-4.5.x
COLLECT_LTO_WRAPPER=/opt/software/x86_64/gcc-4.5.x/libexec/gcc/x86_64-unknown-linux-gnu/4.5.2/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-4_5-branch/configure
--prefix=/opt/software/x86_64/gcc-4.5.x --program-suffix=-4.5.x
--enable-languages=c,c++ --enable-checking
Thread model: posix
gcc version 4.5.2 20100930 (prerelease) (GCC)
COLLECT_GCC_OPTIONS='-v' '-O2' '-c' '-shared-libgcc' '-mtune=generic'
'-march=x86-64'

/opt/software/x86_64/gcc-4.5.x/libexec/gcc/x86_64-unknown-linux-gnu/4.5.2/cc1plus
-quiet -v -D_GNU_SOURCE ice-redirect_eh_edge_1-tree-eh-c-2131.min.cpp -quiet
-dumpbase ice-redirect_eh_edge_1-tree-eh-c-2131.min.cpp -mtune=generic
-march=x86-64 -auxbase ice-redirect_eh_edge_1-tree-eh-c-2131.min -O2 -version
-o /tmp/ccbGteU6.s
GNU C++ (GCC) version 4.5.2 20100930 (prerelease) (x86_64-unknown-linux-gnu)
        compiled by GNU C version 4.5.2 20100930 (prerelease), GMP version
4.3.2, MPFR version 3.0.0-p3, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
ignoring nonexistent directory
"/opt/software/x86_64/gcc-4.5.x/lib/gcc/x86_64-unknown-linux-gnu/4.5.2/../../../../x86_64-unknown-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:

/opt/software/x86_64/gcc-4.5.x/lib/gcc/x86_64-unknown-linux-gnu/4.5.2/../../../../include/c++/4.5.2

/opt/software/x86_64/gcc-4.5.x/lib/gcc/x86_64-unknown-linux-gnu/4.5.2/../../../../include/c++/4.5.2/x86_64-unknown-linux-gnu

/opt/software/x86_64/gcc-4.5.x/lib/gcc/x86_64-unknown-linux-gnu/4.5.2/../../../../include/c++/4.5.2/backward
 /usr/local/include
 /opt/software/x86_64/gcc-4.5.x/include
 /opt/software/x86_64/gcc-4.5.x/lib/gcc/x86_64-unknown-linux-gnu/4.5.2/include

/opt/software/x86_64/gcc-4.5.x/lib/gcc/x86_64-unknown-linux-gnu/4.5.2/include-fixed
 /usr/include
End of search list.
GNU C++ (GCC) version 4.5.2 20100930 (prerelease) (x86_64-unknown-linux-gnu)
        compiled by GNU C version 4.5.2 20100930 (prerelease), GMP version
4.3.2, MPFR version 3.0.0-p3, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: 1be67b2d58ac92677e3812da572956df
ice-redirect_eh_edge_1-tree-eh-c-2131.min.cpp:28:3: warning: non-local variable
‘<anonymous struct> a’ uses anonymous type
ice-redirect_eh_edge_1-tree-eh-c-2131.min.cpp: In constructor ‘<anonymous
struct>::._0()’:
ice-redirect_eh_edge_1-tree-eh-c-2131.min.cpp:28:5: internal compiler error: in
redirect_eh_edge_1, at tree-eh.c:2131
Please submit a full bug report,


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

* [Bug middle-end/45854] [4.5 Regression] ICE in redirect_eh_edge_1, at tree-eh.c:2131
  2010-10-01  7:25 [Bug middle-end/45854] New: ICE in redirect_eh_edge_1, at tree-eh.c:2131 gcc at abeckmann dot de
@ 2010-10-01 10:38 ` rguenth at gcc dot gnu.org
  2010-10-01 12:05 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2010-10-01 10:38 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2010.10.01 10:38:16
         AssignedTo|unassigned at gcc dot       |rguenth at gcc dot gnu.org
                   |gnu.org                     |
   Target Milestone|---                         |4.5.2
            Summary|ICE in redirect_eh_edge_1,  |[4.5 Regression] ICE in
                   |at tree-eh.c:2131           |redirect_eh_edge_1, at
                   |                            |tree-eh.c:2131
     Ever Confirmed|0                           |1

--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2010-10-01 10:38:16 UTC ---
Confirmed.

#1  0x0000000000c55d81 in redirect_eh_edge_1 (edge_in=0x7ffff5b4bb00, 
    new_bb=0x7ffff5b596e8, change_region=0 '\000')
    at /space/rguenther/src/svn/gcc-4_5-branch/gcc/tree-eh.c:2131
#2  0x0000000000c5bc01 in cleanup_empty_eh_merge_phis (new_bb=0x7ffff5b596e8, 
    old_bb=0x7ffff5b596e8, old_bb_out=0x7ffff5b4bd80, change_region=0 '\000')
    at /space/rguenther/src/svn/gcc-4_5-branch/gcc/tree-eh.c:3594
#3  0x0000000000c5bfe8 in cleanup_empty_eh_unsplit (bb=0x7ffff5b596e8, 
    e_out=0x7ffff5b4bd80, lp=0x7ffff5b50a78)
    at /space/rguenther/src/svn/gcc-4_5-branch/gcc/tree-eh.c:3673
#4  0x0000000000c5c1de in cleanup_empty_eh (lp=0x7ffff5b50a78)
    at /space/rguenther/src/svn/gcc-4_5-branch/gcc/tree-eh.c:3723
#5  0x0000000000c5c523 in cleanup_all_empty_eh ()
    at /space/rguenther/src/svn/gcc-4_5-branch/gcc/tree-eh.c:3825
#6  0x0000000000c5c5b3 in execute_cleanup_eh ()
    at /space/rguenther/src/svn/gcc-4_5-branch/gcc/tree-eh.c:3854
#7  0x0000000000b15380 in execute_one_pass (pass=0x18ca7a0)
    at /space/rguenther/src/svn/gcc-4_5-branch/gcc/passes.c:1568
(gdb) p *pass
$1 = {type = GIMPLE_PASS, name = 0x13b7692 "ehcleanup", 
  gate = 0xc5c5ef <gate_cleanup_eh>, execute = 0xc5c579 <execute_cleanup_eh>, 
  sub = 0x0, next = 0x18c90e0, static_pass_number = 41, tv_id = TV_TREE_EH, 
  properties_required = 2, properties_provided = 0, properties_destroyed = 0, 
  todo_flags_start = 524288, todo_flags_finish = 1}
(gdb) call debug_function (cfun->decl, 1<<19 | 1<<5)
<anonymous struct>::._0() (struct ._0 * const this)
Eh tree:
   1 cleanup
{
  struct Y * D.2249;
  struct S * D.2248;
  struct X D.2247;

  # BLOCK 2
  # PRED: ENTRY (fallthru,exec)
  D.2247 = {};
  D.2248_2 = &this_1(D)->s;
  S::S (D.2248_2, D.2247);
  D.2249_3 = &this_1(D)->y;
  [LP 1] Y::Y (D.2249_3);
  # SUCC: 5 (eh,exec) 3 (fallthru,exec)

  # BLOCK 3
  # PRED: 2 (fallthru,exec)
  return;
  # SUCC: EXIT

  # BLOCK 4
  # PRED:
<L0>:
  # SUCC:

  # BLOCK 5 freq:10000
  # PRED: 5 [100.0%]  (fallthru,dfs_back) 2 (eh,exec)
<L1>:
  goto <bb 5> (<L1>);
  # SUCC: 5 [100.0%]  (fallthru,dfs_back)

}
(gdb) p edge_in->dest->index
$4 = 5
(gdb) p new_bb->index
$5 = 5

so we're trying to re-direct an EH edge from BB 5 to BB 5 ...

And the following fixes it.

Index: gcc/tree-eh.c
===================================================================
--- gcc/tree-eh.c       (revision 164873)
+++ gcc/tree-eh.c       (working copy)
@@ -3720,7 +3720,13 @@ cleanup_empty_eh (eh_landing_pad lp)

   /* If the block is totally empty, look for more unsplitting cases.  */
   if (gsi_end_p (gsi))
-    return cleanup_empty_eh_unsplit (bb, e_out, lp);
+    {
+      /* For the degenerate case of an infinite loop bail out.  */
+      if (e_out->dest == bb)
+       return false;
+
+      return cleanup_empty_eh_unsplit (bb, e_out, lp);
+    }

   /* The block should consist only of a single RESX statement.  */
   resx = gsi_stmt (gsi);


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

* [Bug middle-end/45854] [4.5 Regression] ICE in redirect_eh_edge_1, at tree-eh.c:2131
  2010-10-01  7:25 [Bug middle-end/45854] New: ICE in redirect_eh_edge_1, at tree-eh.c:2131 gcc at abeckmann dot de
  2010-10-01 10:38 ` [Bug middle-end/45854] [4.5 Regression] " rguenth at gcc dot gnu.org
@ 2010-10-01 12:05 ` rguenth at gcc dot gnu.org
  2010-10-01 12:08 ` rguenth at gcc dot gnu.org
  2010-10-01 12:08 ` rguenth at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2010-10-01 12:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2010-10-01 12:05:48 UTC ---
Author: rguenth
Date: Fri Oct  1 12:05:42 2010
New Revision: 164880

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=164880
Log:
2010-10-01  Richard Guenther  <rguenther@suse.de>

    PR tree-optimization/45854
    * tree-eh.c (cleanup_empty_eh): Avoid degenerate case.

    * g++.dg/torture/pr45854.C: New testcase.

Added:
    branches/gcc-4_5-branch/gcc/testsuite/g++.dg/torture/pr45854.C
Modified:
    branches/gcc-4_5-branch/gcc/ChangeLog
    branches/gcc-4_5-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_5-branch/gcc/tree-eh.c


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

* [Bug middle-end/45854] [4.5 Regression] ICE in redirect_eh_edge_1, at tree-eh.c:2131
  2010-10-01  7:25 [Bug middle-end/45854] New: ICE in redirect_eh_edge_1, at tree-eh.c:2131 gcc at abeckmann dot de
  2010-10-01 10:38 ` [Bug middle-end/45854] [4.5 Regression] " rguenth at gcc dot gnu.org
  2010-10-01 12:05 ` rguenth at gcc dot gnu.org
@ 2010-10-01 12:08 ` rguenth at gcc dot gnu.org
  2010-10-01 12:08 ` rguenth at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2010-10-01 12:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Richard Guenther <rguenth at gcc dot gnu.org> 2010-10-01 12:07:54 UTC ---
Author: rguenth
Date: Fri Oct  1 12:07:47 2010
New Revision: 164881

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=164881
Log:
2010-10-01  Richard Guenther  <rguenther@suse.de>

    PR tree-optimization/45854
    * tree-eh.c (cleanup_empty_eh): Avoid degenerate case.

    * g++.dg/torture/pr45854.C: New testcase.

Added:
    trunk/gcc/testsuite/g++.dg/torture/pr45854.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-eh.c


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

* [Bug middle-end/45854] [4.5 Regression] ICE in redirect_eh_edge_1, at tree-eh.c:2131
  2010-10-01  7:25 [Bug middle-end/45854] New: ICE in redirect_eh_edge_1, at tree-eh.c:2131 gcc at abeckmann dot de
                   ` (2 preceding siblings ...)
  2010-10-01 12:08 ` rguenth at gcc dot gnu.org
@ 2010-10-01 12:08 ` rguenth at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2010-10-01 12:08 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #4 from Richard Guenther <rguenth at gcc dot gnu.org> 2010-10-01 12:08:40 UTC ---
Fixed.


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

end of thread, other threads:[~2010-10-01 12:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-01  7:25 [Bug middle-end/45854] New: ICE in redirect_eh_edge_1, at tree-eh.c:2131 gcc at abeckmann dot de
2010-10-01 10:38 ` [Bug middle-end/45854] [4.5 Regression] " rguenth at gcc dot gnu.org
2010-10-01 12:05 ` rguenth at gcc dot gnu.org
2010-10-01 12:08 ` rguenth at gcc dot gnu.org
2010-10-01 12:08 ` rguenth 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).