===================================================================
@@ -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);
===================================================================
@@ -0,0 +1,30 @@
+// { dg-do compile }
+
+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 ;
+