* Fix PR ipa/83983 (partially)
@ 2018-03-02 8:49 Eric Botcazou
2018-03-02 9:35 ` Richard Biener
0 siblings, 1 reply; 2+ messages in thread
From: Eric Botcazou @ 2018-03-02 8:49 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 1686 bytes --]
Hi,
this PR reports the failure of g++.dg/lto/pr83121 on multiple platforms.
There are 2 differents issues and this message is about the missing warning on
Aarch64 and SPARC. On these platforms the LTO compiler issues:
/home/ebotcazou/src/gcc/testsuite/g++.dg/lto/pr83121_0.C:6:8: warning: type
'struct Environment' violates the C++ One Definition Rule [-Wodr]
/home/ebotcazou/src/gcc/testsuite/g++.dg/lto/pr83121_1.C:1:8: note: a type
with different size is defined in another translation unit
instead of the expected more verbose warning, as for example on x86. The
discrepancy between x86 and Aarch64/SPARC comes from:
/* For ODR types be sure to compare their names.
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))
{
if (!types_same_for_odr (t1, t2, true))
return false;
/* Limit recursion: If subtypes are ODR types and we know
that they are same, be happy. */
if (!odr_type_p (t1) || !get_odr_type (t1, true)->odr_violated)
return true;
}
The call to get_odr_type (t1, true) is supposed to yield the warning, but this
depends on the order in which types t1 and t2 have been inserted in the table.
In other words, get_odr_type (t1, true) works on x86 while on Aarch64/SPARC
get_odr_type (t2, true) works instead. Hence the propose fix.
Tested on x86-64/Linux and SPARC64/Linux, OK for the mainline?
2018-03-02 Eric Botcazou <ebotcazou@adacore.com>
PR ipa/83983
* ipa-devirt.c (odr_subtypes_equivalent_p): Get the ODR type of both
arguments if they are comparable.
--
Eric Botcazou
[-- Attachment #2: pr83983.diff --]
[-- Type: text/x-patch, Size: 606 bytes --]
Index: ipa-devirt.c
===================================================================
--- ipa-devirt.c (revision 258068)
+++ ipa-devirt.c (working copy)
@@ -686,7 +686,10 @@ odr_subtypes_equivalent_p (tree t1, tree t2,
return false;
/* Limit recursion: If subtypes are ODR types and we know
that they are same, be happy. */
- if (!odr_type_p (t1) || !get_odr_type (t1, true)->odr_violated)
+ if (!odr_type_p (t1)
+ || !odr_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: Fix PR ipa/83983 (partially)
2018-03-02 8:49 Fix PR ipa/83983 (partially) Eric Botcazou
@ 2018-03-02 9:35 ` Richard Biener
0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2018-03-02 9:35 UTC (permalink / raw)
To: Eric Botcazou; +Cc: GCC Patches
On Fri, Mar 2, 2018 at 9:49 AM, Eric Botcazou <ebotcazou@adacore.com> wrote:
> Hi,
>
> this PR reports the failure of g++.dg/lto/pr83121 on multiple platforms.
>
> There are 2 differents issues and this message is about the missing warning on
> Aarch64 and SPARC. On these platforms the LTO compiler issues:
>
> /home/ebotcazou/src/gcc/testsuite/g++.dg/lto/pr83121_0.C:6:8: warning: type
> 'struct Environment' violates the C++ One Definition Rule [-Wodr]
> /home/ebotcazou/src/gcc/testsuite/g++.dg/lto/pr83121_1.C:1:8: note: a type
> with different size is defined in another translation unit
>
> instead of the expected more verbose warning, as for example on x86. The
> discrepancy between x86 and Aarch64/SPARC comes from:
>
> /* For ODR types be sure to compare their names.
> 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))
> {
> if (!types_same_for_odr (t1, t2, true))
> return false;
> /* Limit recursion: If subtypes are ODR types and we know
> that they are same, be happy. */
> if (!odr_type_p (t1) || !get_odr_type (t1, true)->odr_violated)
> return true;
> }
>
> The call to get_odr_type (t1, true) is supposed to yield the warning, but this
> depends on the order in which types t1 and t2 have been inserted in the table.
>
> In other words, get_odr_type (t1, true) works on x86 while on Aarch64/SPARC
> get_odr_type (t2, true) works instead. Hence the propose fix.
>
> Tested on x86-64/Linux and SPARC64/Linux, OK for the mainline?
Ok with a comment explaining why we call both even though
types_same_for_odr holds true.
Thanks,
Richard.
>
> 2018-03-02 Eric Botcazou <ebotcazou@adacore.com>
>
> PR ipa/83983
> * ipa-devirt.c (odr_subtypes_equivalent_p): Get the ODR type of both
> arguments if they are comparable.
>
> --
> Eric Botcazou
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-03-02 9:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-02 8:49 Fix PR ipa/83983 (partially) Eric Botcazou
2018-03-02 9:35 ` 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).