* [patch] Fix PR lto/84805
@ 2018-03-12 23:07 Eric Botcazou
2018-03-13 9:14 ` Richard Biener
0 siblings, 1 reply; 2+ messages in thread
From: Eric Botcazou @ 2018-03-12 23:07 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 539 bytes --]
Hi,
this is an ICE in LTO mode on code violating the ODR rule: get_odr_type checks
that there is a sensible internal order between base, type and derived types
but this can be easily messed up by incomplete types. Hence the attached
fixlet (no testcase because the -Wodr warnings have a totally random order).
Tested on x86-64/Linux, OK for the mainline?
2018-03-12 Eric Botcazou <ebotcazou@adacore.com>
PR lto/84805
* ipa-devirt.c (odr_subtypes_equivalent_p): Do not get the ODR type of
incomplete types.
--
Eric Botcazou
[-- Attachment #2: pr84805.diff --]
[-- Type: text/x-patch, Size: 1173 bytes --]
Index: ipa-devirt.c
===================================================================
--- ipa-devirt.c (revision 258411)
+++ ipa-devirt.c (working copy)
@@ -656,7 +656,7 @@ set_type_binfo (tree type, tree binfo)
gcc_assert (!TYPE_BINFO (type));
}
-/* Compare T2 and T2 based on name or structure. */
+/* Compare T1 and T2 based on name or structure. */
static bool
odr_subtypes_equivalent_p (tree t1, tree t2,
@@ -678,7 +678,7 @@ odr_subtypes_equivalent_p (tree t1, tree
return false;
/* For ODR types be sure to compare their names.
- To support -wno-odr-type-merging we allow one type to be non-ODR
+ To support -Wno-odr-type-merging we allow one type to be non-ODR
and other ODR even though it is a violation. */
if (types_odr_comparable (t1, t2, true))
{
@@ -690,6 +690,8 @@ odr_subtypes_equivalent_p (tree t1, tree
therefore which call will report the ODR violation, if any. */
if (!odr_type_p (t1)
|| !odr_type_p (t2)
+ || !COMPLETE_TYPE_P (t1)
+ || !COMPLETE_TYPE_P (t2)
|| (!get_odr_type (t1, true)->odr_violated
&& !get_odr_type (t2, true)->odr_violated))
return true;
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [patch] Fix PR lto/84805
2018-03-12 23:07 [patch] Fix PR lto/84805 Eric Botcazou
@ 2018-03-13 9:14 ` Richard Biener
0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2018-03-13 9:14 UTC (permalink / raw)
To: Eric Botcazou; +Cc: GCC Patches
On Tue, Mar 13, 2018 at 12:06 AM, Eric Botcazou <ebotcazou@adacore.com> wrote:
> Hi,
>
> this is an ICE in LTO mode on code violating the ODR rule: get_odr_type checks
> that there is a sensible internal order between base, type and derived types
> but this can be easily messed up by incomplete types. Hence the attached
> fixlet (no testcase because the -Wodr warnings have a totally random order).
>
> Tested on x86-64/Linux, OK for the mainline?
Ok.
Richard.
>
> 2018-03-12 Eric Botcazou <ebotcazou@adacore.com>
>
> PR lto/84805
> * ipa-devirt.c (odr_subtypes_equivalent_p): Do not get the ODR type of
> incomplete types.
>
> --
> Eric Botcazou
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-03-13 9:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-12 23:07 [patch] Fix PR lto/84805 Eric Botcazou
2018-03-13 9:14 ` Richard Biener
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).