* [PATCH] Fix PR49615
@ 2011-07-04 12:02 Richard Guenther
0 siblings, 0 replies; only message in thread
From: Richard Guenther @ 2011-07-04 12:02 UTC (permalink / raw)
To: gcc-patches
This fixes an oversight in split_bbs_on_noreturn_calls.
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied everywhere.
Richard.
2011-07-04 Richard Guenther <rguenther@suse.de>
PR tree-optimization/49615
* tree-cfgcleanup.c (split_bbs_on_noreturn_calls): Fix
basic-block index check.
* g++.dg/torture/pr49615.C: New testcase.
Index: gcc/tree-cfgcleanup.c
===================================================================
*** gcc/tree-cfgcleanup.c (revision 175752)
--- gcc/tree-cfgcleanup.c (working copy)
*************** split_bbs_on_noreturn_calls (void)
*** 599,605 ****
BB is present in the cfg. */
if (bb == NULL
|| bb->index < NUM_FIXED_BLOCKS
! || bb->index >= n_basic_blocks
|| BASIC_BLOCK (bb->index) != bb
|| !gimple_call_noreturn_p (stmt))
continue;
--- 599,605 ----
BB is present in the cfg. */
if (bb == NULL
|| bb->index < NUM_FIXED_BLOCKS
! || bb->index >= last_basic_block
|| BASIC_BLOCK (bb->index) != bb
|| !gimple_call_noreturn_p (stmt))
continue;
Index: gcc/testsuite/g++.dg/torture/pr49615.C
===================================================================
*** gcc/testsuite/g++.dg/torture/pr49615.C (revision 0)
--- gcc/testsuite/g++.dg/torture/pr49615.C (revision 0)
***************
*** 0 ****
--- 1,29 ----
+ /* { dg-do compile } */
+ /* { dg-options "-g" } */
+
+ template <class T>
+ static inline bool Dispatch (T* obj, void (T::*func) ())
+ {
+ (obj->*func) ();
+ }
+ class C
+ {
+ bool f (int);
+ void g ();
+ };
+ bool C::f (int n)
+ {
+ bool b;
+ switch (n)
+ {
+ case 0:
+ b = Dispatch (this, &C::g);
+ case 1:
+ b = Dispatch (this, &C::g);
+ }
+ }
+ void C::g ()
+ {
+ for (;;) { }
+ }
+
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-07-04 12:02 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-04 12:02 [PATCH] Fix PR49615 Richard Guenther
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).