diff options
author | Richard Biener <rguenther@suse.de> | 2012-10-25 11:16:12 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2012-10-25 11:16:12 +0000 |
commit | 9c370032cf787513298297be04ddf8b02ac2f336 (patch) | |
tree | 8de88ebb51b852c880286c7f797faeedc6b31474 /gcc | |
parent | 3a969a32ff392ed49a60050a8b94d1dfdc05a5f3 (diff) | |
download | gcc-9c370032cf787513298297be04ddf8b02ac2f336.zip gcc-9c370032cf787513298297be04ddf8b02ac2f336.tar.gz gcc-9c370032cf787513298297be04ddf8b02ac2f336.tar.bz2 |
re PR target/54902 (, ICE (segfault) building on arm-linux-gnueabi)
2012-10-25 Richard Biener <rguenther@suse.de>
PR tree-optimization/54902
* tree-ssa-pre.c (fini_eliminate): Return TODO.
(do_pre): Adjust.
(execute_fre): Likewise.
* tree-ssa-tailmerge.c (tail_merge_optimize): Delete unreachable
blocks before computing dominators.
* g++.dg/torture/pr54902.C: New testcase.
From-SVN: r192804
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/torture/pr54902.C | 131 | ||||
-rw-r--r-- | gcc/tree-ssa-pre.c | 9 | ||||
-rw-r--r-- | gcc/tree-ssa-tail-merge.c | 7 |
5 files changed, 156 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d6591a2..59c476f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2012-10-25 Richard Biener <rguenther@suse.de> + + PR tree-optimization/54902 + * tree-ssa-pre.c (fini_eliminate): Return TODO. + (do_pre): Adjust. + (execute_fre): Likewise. + * tree-ssa-tailmerge.c (tail_merge_optimize): Delete unreachable + blocks before computing dominators. + 2012-10-25 Richard Sandiford <rdsandiford@googlemail.com> * expr.c (emit_block_move_via_loop): Use simplify_gen_binary diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bcbc0f2..6c0a2f7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2012-10-25 Richard Biener <rguenther@suse.de> + + PR tree-optimization/54902 + * g++.dg/torture/pr54902.C: New testcase. + 2012-10-25 Paolo Carlini <paolo.carlini@oracle.com> PR c++/34892 diff --git a/gcc/testsuite/g++.dg/torture/pr54902.C b/gcc/testsuite/g++.dg/torture/pr54902.C new file mode 100644 index 0000000..790ffe5 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr54902.C @@ -0,0 +1,131 @@ +// { dg-do compile } + +namespace std __attribute__ ((__visibility__ ("default"))) { + template<typename _Iterator> struct iterator_traits { + }; + template<typename _Tp> struct iterator_traits<_Tp*> { + typedef _Tp& reference; + }; +} +namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) { + using std::iterator_traits; + template<typename _Iterator, typename _Container> class __normal_iterator { + _Iterator _M_current; + typedef iterator_traits<_Iterator> __traits_type; + public: + typedef typename __traits_type::reference reference; + explicit __normal_iterator(const _Iterator& __i) : _M_current(__i) { + } + reference operator*() const { + return *_M_current; + } + __normal_iterator operator++(int) { + return __normal_iterator(_M_current++); + } + }; + template<typename _Tp> class new_allocator { + public: + typedef _Tp* pointer; + template<typename _Tp1> struct rebind { + typedef new_allocator<_Tp1> other; + }; + }; +} +namespace std __attribute__ ((__visibility__ ("default"))) { + template<typename _Tp> class allocator: public __gnu_cxx::new_allocator<_Tp> { + }; +} +namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) { + template<typename _Alloc> struct __alloc_traits { + typedef typename _Alloc::pointer pointer; + template<typename _Tp> struct rebind { + typedef typename _Alloc::template rebind<_Tp>::other other; + }; + }; +} +namespace std __attribute__ ((__visibility__ ("default"))) { + template<typename _Tp, typename _Alloc> struct _Vector_base { + typedef typename __gnu_cxx::__alloc_traits<_Alloc>::template rebind<_Tp>::other _Tp_alloc_type; + typedef typename __gnu_cxx::__alloc_traits<_Tp_alloc_type>::pointer pointer; + struct _Vector_impl : public _Tp_alloc_type { + pointer _M_start; + }; + _Vector_impl _M_impl; + }; + template<typename _Tp, typename _Alloc = std::allocator<_Tp> > class vector : protected _Vector_base<_Tp, _Alloc> { + typedef _Vector_base<_Tp, _Alloc> _Base; + public: + typedef typename _Base::pointer pointer; + typedef __gnu_cxx::__normal_iterator<pointer, vector> iterator; + iterator begin() { + return iterator(this->_M_impl._M_start); + } + }; +} +class myServer { + static std::vector<myServer *> server_list; + class Callback; + class myFolder *currentFolder; + static bool eventloop(Callback *); +}; +extern "C" { + typedef unsigned int uint32_t; + typedef uint32_t unicode_char; + extern int strcmp (__const char *__s1, __const char *__s2) throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +}; +class CursesObj { +}; +class Curses : public CursesObj { +public: + class Key { + public: + unicode_char ukey; + const char *keycode; + Key(unicode_char ch) : ukey(ch), keycode(0) { + } + bool plain() const { + } + bool nokey() const { + } + bool operator==(const Key &k) const { + return strcmp(keycode ? keycode: + "", k.keycode ? k.keycode: + "") == 0 && ukey == k.ukey; + } + }; + static bool processKey(const Key &k); +}; +class CursesContainer : public Curses { +}; +class myFolder { +public: + void checkExpunged(); +}; +class Typeahead { +public: + static Typeahead *typeahead; + bool empty() { + } + Curses::Key pop() { + } +}; +class CursesScreen : public CursesContainer { +public: + Key getKey(); +}; +using namespace std; +extern CursesScreen *cursesScreen; +bool myServer::eventloop(myServer::Callback *callback) { + Curses::Key k1= (callback == __null && !Typeahead::typeahead->empty() ? Typeahead::typeahead->pop() : cursesScreen->getKey()); + if (callback == __null || (k1.plain() && k1.ukey == '\x03')) { + if (!k1.nokey()) { + bool rc=Curses::processKey(k1); + if (rc) { while (k1.plain() && k1 == '\x03' && !Typeahead::typeahead->empty()) Typeahead::typeahead->pop(); } + } + } + vector<myServer *>::iterator b=server_list.begin(); + while (1) { + myServer *p= *b++; + if (p->currentFolder) p->currentFolder->checkExpunged(); + } +} diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c index 548c110..bc3381bd 100644 --- a/gcc/tree-ssa-pre.c +++ b/gcc/tree-ssa-pre.c @@ -4448,7 +4448,7 @@ eliminate (void) /* Perform CFG cleanups made necessary by elimination. */ -static void +static unsigned fini_eliminate (void) { bool do_eh_cleanup = !bitmap_empty_p (need_eh_cleanup); @@ -4464,7 +4464,8 @@ fini_eliminate (void) BITMAP_FREE (need_ab_cleanup); if (do_eh_cleanup || do_ab_cleanup) - cleanup_tree_cfg (); + return TODO_cleanup_cfg; + return 0; } /* Borrow a bit of tree-ssa-dce.c for the moment. @@ -4728,7 +4729,7 @@ do_pre (void) scev_finalize (); fini_pre (); - fini_eliminate (); + todo |= fini_eliminate (); loop_optimizer_finalize (); /* TODO: tail_merge_optimize may merge all predecessors of a block, in which @@ -4794,7 +4795,7 @@ execute_fre (void) /* Remove all the redundant expressions. */ todo |= eliminate (); - fini_eliminate (); + todo |= fini_eliminate (); free_scc_vn (); diff --git a/gcc/tree-ssa-tail-merge.c b/gcc/tree-ssa-tail-merge.c index 372096c..79fb1a6 100644 --- a/gcc/tree-ssa-tail-merge.c +++ b/gcc/tree-ssa-tail-merge.c @@ -1600,7 +1600,12 @@ tail_merge_optimize (unsigned int todo) timevar_push (TV_TREE_TAIL_MERGE); - calculate_dominance_info (CDI_DOMINATORS); + if (!dom_info_available_p (CDI_DOMINATORS)) + { + /* PRE can leave us with unreachable blocks, remove them now. */ + delete_unreachable_blocks (); + calculate_dominance_info (CDI_DOMINATORS); + } init_worklist (); while (!VEC_empty (same_succ, worklist)) |