This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug ipa/61998] [5 Regression] ICE: Segmentation fault with -Wsuggest-final-types
- From: "trippels at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 23 Aug 2014 05:12:21 +0000
- Subject: [Bug ipa/61998] [5 Regression] ICE: Segmentation fault with -Wsuggest-final-types
- Auto-submitted: auto-generated
- References: <bug-61998-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61998
--- Comment #5 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
(In reply to Jan Hubicka from comment #4)
> I suppose VECtors do not like to grow to 0 size. THe following patch fixes
> the ICE, does it also fixe you real testcases?
> Index: ipa-devirt.c
> ===================================================================
> --- ipa-devirt.c (revision 214303)
> +++ ipa-devirt.c (working copy)
> @@ -3822,6 +3845,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.length ())
> + 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.
That patch would crash the minimal and empty testcase even without
-Wsuggest-final-types.
You probably mean:
diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c
index 2e74ca61c508..acfd5d2fdede 100644
--- a/gcc/ipa-devirt.c
+++ b/gcc/ipa-devirt.c
@@ -3822,6 +3822,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.