diff options
author | Steven Bosscher <steven@gcc.gnu.org> | 2012-11-11 20:29:11 +0000 |
---|---|---|
committer | Steven Bosscher <steven@gcc.gnu.org> | 2012-11-11 20:29:11 +0000 |
commit | 159520acf76cf7159e171370e06c7a6dd51d594d (patch) | |
tree | 543961f5fa17d2845bed07701ce91e092266962c | |
parent | 18abab9fee744f3e47654b4e7efbaeb6bfbf9574 (diff) | |
download | gcc-159520acf76cf7159e171370e06c7a6dd51d594d.zip gcc-159520acf76cf7159e171370e06c7a6dd51d594d.tar.gz gcc-159520acf76cf7159e171370e06c7a6dd51d594d.tar.bz2 |
re PR middle-end/55263 (ICE: pre_and_rev_post_order_compute, at cfganal.c:875 with -O -fgcse-after-reload -fnon-call-exceptions)
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.
From-SVN: r193412
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/postreload.c | 5 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/pr55263.C | 68 |
4 files changed, 82 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9657310..51b4ed6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2012-11-11 Steven Bosscher <steven@gcc.gnu.org> + + 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. + 2012-11-11 Sandra Loosemore <sandra@codesourcery.com> * doc/extend.texi: Copy-edit to use "built-in function" instead diff --git a/gcc/postreload.c b/gcc/postreload.c index cafcf0f..32c5b5f 100644 --- a/gcc/postreload.c +++ b/gcc/postreload.c @@ -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; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d1d3389..deaf75c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2012-11-11 Steven Bosscher <steven@gcc.gnu.org> + + PR middle-end/55263 + * g++.dg/pr55263.C: New test. + 2012-11-11 Martin Jambor <mjambor@suse.cz> PR tree-optimization/55238 diff --git a/gcc/testsuite/g++.dg/pr55263.C b/gcc/testsuite/g++.dg/pr55263.C new file mode 100644 index 0000000..5ea863f --- /dev/null +++ b/gcc/testsuite/g++.dg/pr55263.C @@ -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 > >; +} + |