]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR ipa/61998 Fix crash -Wsuggest-final-types crash
authorMarkus Trippelsdorf <markus@trippelsdorf.de>
Fri, 19 Sep 2014 14:44:09 +0000 (14:44 +0000)
committerMarkus Trippelsdorf <trippels@gcc.gnu.org>
Fri, 19 Sep 2014 14:44:09 +0000 (14:44 +0000)
-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  <markus@trippelsdorf.de>

        PR ipa/61998
        * ipa-devirt.c (ipa_devirt): Bail out if odr_types_ptr is NULL.

2014-09-19  Markus Trippelsdorf  <markus@trippelsdorf.de>

        PR ipa/61998
        * g++.dg/warn/Wsuggest-final-2.C: New testcase.

From-SVN: r215392

gcc/ChangeLog
gcc/ipa-devirt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/warn/Wsuggest-final-2.C [new file with mode: 0644]

index c2200fcdc426b94a471a1727ca08e5c628ae9f5d..0dc7b3325922aa40b79371d03008f0ff4356c0ba 100644 (file)
@@ -1,3 +1,8 @@
+2014-09-19  Markus Trippelsdorf  <markus@trippelsdorf.de>
+
+       PR ipa/61998
+       * ipa-devirt.c (ipa_devirt): Bail out if odr_types_ptr is NULL.
+
 2014-09-19  James Greenhalgh  <james.greenhalgh@arm.com>
 
        * doc/md.texi (Modifiers): Consistently use "read/write"
index 0a11eb72085fd7c1f02564fb9340381f9c38adc8..61e87e80240c026d43f566ff07c72fe131e0716f 100644 (file)
@@ -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.
index b0f2bc80696e4cf1555d94c4cdf1b42b83abbbcc..747aad8b6a309a3df68f2228624e2480c64834b8 100644 (file)
@@ -1,3 +1,8 @@
+2014-09-19  Markus Trippelsdorf  <markus@trippelsdorf.de>
+
+       PR ipa/61998
+       * g++.dg/warn/Wsuggest-final-2.C: New testcase.
+
 2014-09-19  Joost VandeVondele  <vondele@gcc.gnu.org>
 
        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 (file)
index 0000000..51e466d
--- /dev/null
@@ -0,0 +1,4 @@
+// PR ipa/61998
+// { dg-do compile }
+// { dg-options "-O2 -Wsuggest-final-types" }
+int main () {}