From 4cd5658b606e4a72cdc64387e5b6bf808ba5d81d Mon Sep 17 00:00:00 2001 From: Markus Trippelsdorf Date: Fri, 19 Sep 2014 14:44:09 +0000 Subject: [PATCH] PR ipa/61998 Fix crash -Wsuggest-final-types crash -Wsuggest-final-types crashes when used on mininal testcases. Fix by bailing out early when odr_types_ptr is NULL in ipa_devirt() 2014-09-19 Markus Trippelsdorf PR ipa/61998 * ipa-devirt.c (ipa_devirt): Bail out if odr_types_ptr is NULL. 2014-09-19 Markus Trippelsdorf PR ipa/61998 * g++.dg/warn/Wsuggest-final-2.C: New testcase. From-SVN: r215392 --- gcc/ChangeLog | 5 +++++ gcc/ipa-devirt.c | 3 +++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/warn/Wsuggest-final-2.C | 4 ++++ 4 files changed, 17 insertions(+) create mode 100644 gcc/testsuite/g++.dg/warn/Wsuggest-final-2.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c2200fcdc42..0dc7b332592 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2014-09-19 Markus Trippelsdorf + + PR ipa/61998 + * ipa-devirt.c (ipa_devirt): Bail out if odr_types_ptr is NULL. + 2014-09-19 James Greenhalgh * doc/md.texi (Modifiers): Consistently use "read/write" diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c index 0a11eb72085..61e87e80240 100644 --- a/gcc/ipa-devirt.c +++ b/gcc/ipa-devirt.c @@ -3952,6 +3952,9 @@ ipa_devirt (void) int nmultiple = 0, noverwritable = 0, ndevirtualized = 0, nnotdefined = 0; int nwrong = 0, nok = 0, nexternal = 0, nartificial = 0; + if (!odr_types_ptr) + return 0; + /* We can output -Wsuggest-final-methods and -Wsuggest-final-types warnings. This is implemented by setting up final_warning_records that are updated by get_polymorphic_call_targets. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b0f2bc80696..747aad8b6a3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-09-19 Markus Trippelsdorf + + PR ipa/61998 + * g++.dg/warn/Wsuggest-final-2.C: New testcase. + 2014-09-19 Joost VandeVondele PR fortran/63152 diff --git a/gcc/testsuite/g++.dg/warn/Wsuggest-final-2.C b/gcc/testsuite/g++.dg/warn/Wsuggest-final-2.C new file mode 100644 index 00000000000..51e466d5940 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wsuggest-final-2.C @@ -0,0 +1,4 @@ +// PR ipa/61998 +// { dg-do compile } +// { dg-options "-O2 -Wsuggest-final-types" } +int main () {} -- 2.30.2