From: Richard Guenther Date: Mon, 4 Jul 2011 12:21:45 +0000 (+0000) Subject: re PR tree-optimization/49615 (internal compiler error: verify_stmts failed / LHS... X-Git-Tag: releases/gcc-4.4.7~335 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=97ba76388e6a946ddf4d7ae52968e797b5eece4e;p=thirdparty%2Fgcc.git re PR tree-optimization/49615 (internal compiler error: verify_stmts failed / LHS in noreturn call with pointer-to-never-returning-member) 2011-07-04 Richard Guenther PR tree-optimization/49615 * tree-cfgcleanup.c (split_bbs_on_noreturn_calls): Fix basic-block index check. * g++.dg/torture/pr49615.C: New testcase. From-SVN: r175808 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fb7d2153c20e..01f8d5f9aba1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2011-07-04 Richard Guenther + + PR tree-optimization/49615 + * tree-cfgcleanup.c (split_bbs_on_noreturn_calls): Fix + basic-block index check. + 2011-06-30 Eric Botcazou PR tree-optimization/49572 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4a4402ad7268..30dafc7a235f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-07-04 Richard Guenther + + PR tree-optimization/49615 + * g++.dg/torture/pr49615.C: New testcase. + 2011-06-30 Richard Guenther PR tree-optimization/38752 diff --git a/gcc/testsuite/g++.dg/torture/pr49615.C b/gcc/testsuite/g++.dg/torture/pr49615.C new file mode 100644 index 000000000000..98a2f95b8b3f --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr49615.C @@ -0,0 +1,29 @@ +/* { dg-do compile } */ +/* { dg-options "-g" } */ + +template +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 (;;) { } +} + diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c index a68dc5c5902d..f0270af49ab0 100644 --- a/gcc/tree-cfgcleanup.c +++ b/gcc/tree-cfgcleanup.c @@ -496,7 +496,7 @@ split_bbs_on_noreturn_calls (void) BB is present in the cfg. */ if (bb == NULL || bb->index < NUM_FIXED_BLOCKS - || bb->index >= n_basic_blocks + || bb->index >= last_basic_block || BASIC_BLOCK (bb->index) != bb || last_stmt (bb) == stmt || !gimple_call_noreturn_p (stmt))