gcc/
	PR middle-end/55263
	* postreload.c (rest_of_handle_postreload): With non-call exceptions,
	if edges are purged call cleanup_cfg to remove unreachable blocks.

testsuite/
	PR middle-end/55263
	* g++.dg/pr55263.C: New test.

Index: postreload.c
===================================================================
--- postreload.c	(revision 193396)
+++ postreload.c	(working copy)
@@ -2289,8 +2289,9 @@ rest_of_handle_postreload (void)
   reload_cse_regs (get_insns ());
   /* Reload_cse_regs can eliminate potentially-trapping MEMs.
      Remove any EH edges associated with them.  */
-  if (cfun->can_throw_non_call_exceptions)
-    purge_all_dead_edges ();
+  if (cfun->can_throw_non_call_exceptions
+      && purge_all_dead_edges ())
+    cleanup_cfg (0);
 
   return 0;
 }
Index: testsuite/g++.dg/pr55263.C
===================================================================
--- testsuite/g++.dg/pr55263.C	(revision 0)
+++ testsuite/g++.dg/pr55263.C	(revision 0)
@@ -0,0 +1,68 @@
+/* { dg-do compile } */
+/* { dg-options "-c -O -fgcse-after-reload -fnon-call-exceptions" } */
+template < typename _Tp > class new_allocator
+{
+public:
+  typedef _Tp pointer;
+  template < typename _Tp1 > struct rebind
+  {
+    typedef new_allocator < _Tp1 > other;
+  };
+
+};
+
+template < typename > class allocator;
+
+template < typename _Alloc > struct __alloc_traits
+{
+  typedef typename _Alloc::pointer pointer;
+    template < typename _Tp > struct rebind
+  {
+    typedef typename _Alloc::template rebind < _Tp >::other other;
+  };
+
+};
+
+template < typename _Tp, typename _Alloc > struct _Vector_base
+{
+  typedef
+    typename
+    __alloc_traits < _Alloc >::template rebind < _Tp >::other _Tp_alloc_type;
+  typedef typename __alloc_traits < _Tp_alloc_type >::pointer pointer;
+  struct _Vector_impl
+  {
+    pointer _M_start;
+    pointer _M_end_of_storage;
+  };
+
+   ~_Vector_base ();
+  _Vector_impl _M_impl;
+};
+
+template < typename _Tp, typename _Alloc = allocator < _Tp > >class vector:
+_Vector_base < _Tp, _Alloc >
+{
+  typedef _Vector_base < _Tp, _Alloc > _Base;
+public:
+  typedef typename _Base::pointer pointer;
+vector ():
+  _Base ()
+  {
+    _M_erase_at_end (this->_M_impl._M_start);
+  }
+  void _M_erase_at_end (pointer)
+  {
+  }
+};
+
+template < typename T > class clear_alloc:
+public new_allocator < T >
+{
+};
+
+void
+foo ()
+{
+  new vector < int, clear_alloc < int > >;
+}
+
