* Re: Fix false -Wodr warnings
@ 2019-04-16 12:51 Dominique d'Humières
2019-04-16 12:55 ` Jan Hubicka
0 siblings, 1 reply; 8+ messages in thread
From: Dominique d'Humières @ 2019-04-16 12:51 UTC (permalink / raw)
To: Jan Hubicka; +Cc: gcc-patches
Hi Jan,
The test causes
WARNING: lto.exp does not support dg-do
WARNING: lto.exp does not support dg-options in primary source file
This is fixed by the following patch
--- ../_clean/gcc/testsuite/g++.dg/lto/pr89358_0.C 2019-04-15 00:04:48.000000000 +0200
+++ gcc/testsuite/g++.dg/lto/pr89358_0.C 2019-04-16 13:13:14.000000000 +0200
@@ -1,5 +1,5 @@
-/* { dg-do link } */
-/* { dg-options "-std=c++17" } */
+/* { dg-lto-do link } */
+/* { dg-lto-options "-std=c++17" } */
#include <map>
extern void test();
--- ../_clean/gcc/testsuite/g++.dg/lto/pr89358_1.C 2019-04-15 00:04:48.000000000 +0200
+++ gcc/testsuite/g++.dg/lto/pr89358_1.C 2019-04-16 13:14:44.000000000 +0200
@@ -1,4 +1,3 @@
-/* { dg-options "-std=c++14" } */
#include <map>
void test()
TIA
Dominique
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Fix false -Wodr warnings
2019-04-16 12:51 Fix false -Wodr warnings Dominique d'Humières
@ 2019-04-16 12:55 ` Jan Hubicka
2019-04-16 13:02 ` Richard Biener
2019-04-16 13:08 ` Jakub Jelinek
0 siblings, 2 replies; 8+ messages in thread
From: Jan Hubicka @ 2019-04-16 12:55 UTC (permalink / raw)
To: Dominique d'Humières; +Cc: gcc-patches
> Hi Jan,
>
> The test causes
>
> WARNING: lto.exp does not support dg-do
> WARNING: lto.exp does not support dg-options in primary source file
>
> This is fixed by the following patch
>
> --- ../_clean/gcc/testsuite/g++.dg/lto/pr89358_0.C 2019-04-15 00:04:48.000000000 +0200
> +++ gcc/testsuite/g++.dg/lto/pr89358_0.C 2019-04-16 13:13:14.000000000 +0200
> @@ -1,5 +1,5 @@
> -/* { dg-do link } */
> -/* { dg-options "-std=c++17" } */
> +/* { dg-lto-do link } */
> +/* { dg-lto-options "-std=c++17" } */
Thanks, this changle is OK.
Honza
> #include <map>
>
> extern void test();
> --- ../_clean/gcc/testsuite/g++.dg/lto/pr89358_1.C 2019-04-15 00:04:48.000000000 +0200
> +++ gcc/testsuite/g++.dg/lto/pr89358_1.C 2019-04-16 13:14:44.000000000 +0200
> @@ -1,4 +1,3 @@
> -/* { dg-options "-std=c++14" } */
> #include <map>
>
> void test()
>
> TIA
>
> Dominique
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Fix false -Wodr warnings
2019-04-16 12:55 ` Jan Hubicka
@ 2019-04-16 13:02 ` Richard Biener
2019-04-16 13:08 ` Jakub Jelinek
1 sibling, 0 replies; 8+ messages in thread
From: Richard Biener @ 2019-04-16 13:02 UTC (permalink / raw)
To: Jan Hubicka; +Cc: Dominique d'Humières, gcc-patches
On Tue, Apr 16, 2019 at 2:51 PM Jan Hubicka <hubicka@ucw.cz> wrote:
>
> > Hi Jan,
> >
> > The test causes
> >
> > WARNING: lto.exp does not support dg-do
> > WARNING: lto.exp does not support dg-options in primary source file
> >
> > This is fixed by the following patch
> >
> > --- ../_clean/gcc/testsuite/g++.dg/lto/pr89358_0.C 2019-04-15 00:04:48.000000000 +0200
> > +++ gcc/testsuite/g++.dg/lto/pr89358_0.C 2019-04-16 13:13:14.000000000 +0200
> > @@ -1,5 +1,5 @@
> > -/* { dg-do link } */
> > -/* { dg-options "-std=c++17" } */
> > +/* { dg-lto-do link } */
> > +/* { dg-lto-options "-std=c++17" } */
>
> Thanks, this changle is OK.
> Honza
> > #include <map>
> >
> > extern void test();
> > --- ../_clean/gcc/testsuite/g++.dg/lto/pr89358_1.C 2019-04-15 00:04:48.000000000 +0200
> > +++ gcc/testsuite/g++.dg/lto/pr89358_1.C 2019-04-16 13:14:44.000000000 +0200
> > @@ -1,4 +1,3 @@
> > -/* { dg-options "-std=c++14" } */
But you should leave this one in place, otherwise it will no longer
test what it was supposed to test.
Richard.
> > #include <map>
> >
> > void test()
> >
> > TIA
> >
> > Dominique
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Fix false -Wodr warnings
2019-04-16 12:55 ` Jan Hubicka
2019-04-16 13:02 ` Richard Biener
@ 2019-04-16 13:08 ` Jakub Jelinek
2019-04-16 14:18 ` Dominique d'Humières
1 sibling, 1 reply; 8+ messages in thread
From: Jakub Jelinek @ 2019-04-16 13:08 UTC (permalink / raw)
To: Jan Hubicka; +Cc: Dominique d'Humières, gcc-patches
On Tue, Apr 16, 2019 at 02:51:14PM +0200, Jan Hubicka wrote:
> > Hi Jan,
> >
> > The test causes
> >
> > WARNING: lto.exp does not support dg-do
> > WARNING: lto.exp does not support dg-options in primary source file
> >
> > This is fixed by the following patch
> >
> > --- ../_clean/gcc/testsuite/g++.dg/lto/pr89358_0.C 2019-04-15 00:04:48.000000000 +0200
> > +++ gcc/testsuite/g++.dg/lto/pr89358_0.C 2019-04-16 13:13:14.000000000 +0200
> > @@ -1,5 +1,5 @@
> > -/* { dg-do link } */
> > -/* { dg-options "-std=c++17" } */
> > +/* { dg-lto-do link } */
> > +/* { dg-lto-options "-std=c++17" } */
>
> Thanks, this changle is OK.
> Honza
> > #include <map>
> >
> > extern void test();
> > --- ../_clean/gcc/testsuite/g++.dg/lto/pr89358_1.C 2019-04-15 00:04:48.000000000 +0200
> > +++ gcc/testsuite/g++.dg/lto/pr89358_1.C 2019-04-16 13:14:44.000000000 +0200
> > @@ -1,4 +1,3 @@
> > -/* { dg-options "-std=c++14" } */
But this change is not ok and makes the test useless.
The whole point of the test is to test if compiling one TU with -std=c++17
and another one with -std=c++14 and linking them together doesn't produce
warnings. I think dg-options in *_1.C is ok, several tests have those:
20100302_1.C:// { dg-options "-fabi-version=0" }
pr60150_1.C:// { dg-options "-fno-lto" }
pr63270_2.C:// { dg-options "-fno-lto" }
pr64076_1.C:// { dg-options -fno-lto }
pr65276_1.C:// { dg-options "-O2" }
pr68811_1.C:// { dg-options "-O2 -flto -w" }
Jakub
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Fix false -Wodr warnings
2019-04-16 13:08 ` Jakub Jelinek
@ 2019-04-16 14:18 ` Dominique d'Humières
2020-01-23 13:53 ` Thomas Schwinge
0 siblings, 1 reply; 8+ messages in thread
From: Dominique d'Humières @ 2019-04-16 14:18 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: Jan Hubicka, gcc-patches, Richard Biener
> Le 16 avr. 2019 à 15:07, Jakub Jelinek <jakub@redhat.com> a écrit :
>
> On Tue, Apr 16, 2019 at 02:51:14PM +0200, Jan Hubicka wrote:
>>> Hi Jan,
>>>
>>> The test causes
>>>
>>> WARNING: lto.exp does not support dg-do
>>> WARNING: lto.exp does not support dg-options in primary source file
>>>
>>> This is fixed by the following patch
>>>
>>> --- ../_clean/gcc/testsuite/g++.dg/lto/pr89358_0.C 2019-04-15 00:04:48.000000000 +0200
>>> +++ gcc/testsuite/g++.dg/lto/pr89358_0.C 2019-04-16 13:13:14.000000000 +0200
>>> @@ -1,5 +1,5 @@
>>> -/* { dg-do link } */
>>> -/* { dg-options "-std=c++17" } */
>>> +/* { dg-lto-do link } */
>>> +/* { dg-lto-options "-std=c++17" } */
>>
>> Thanks, this changle is OK.
>> Honza
Committed as revision r270390
Dominique
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Fix false -Wodr warnings
2019-04-16 14:18 ` Dominique d'Humières
@ 2020-01-23 13:53 ` Thomas Schwinge
0 siblings, 0 replies; 8+ messages in thread
From: Thomas Schwinge @ 2020-01-23 13:53 UTC (permalink / raw)
To: gcc-patches, Jan Hubicka, Martin Liska; +Cc: Richard Biener, dominiq
[-- Attachment #1.1: Type: text/plain, Size: 3886 bytes --]
Hi!
On 2019-04-15T13:55:39+0200, Richard Biener <richard.guenther@gmail.com> wrote:
> On Sun, Apr 14, 2019 at 10:59 PM Jan Hubicka <hubicka@ucw.cz> wrote:
>> this patch fixes false warning that is output when different -std
>> settings are used. In this case C++ FE produces same declaration in
>> different representations which differ by 0 sized fileds only.
>> The patch makes them to be ignored (and I checked we ignore them for
>> canonical type merging too)
>>
>> Bootstrapped/regtested x86_64-linux, comitted.
In 13ef7dc2448c0f9d8981577bb5448ee9b6842b1c "Backport
d2a0371d2641e85c5e6ca396029be32204d976df", Martin backported this to
releases/gcc-8, but without including the fix-up for...
> The testcase is bogus
>
> WARNING: lto.exp does not support dg-do
> WARNING: lto.exp does not support dg-options in primary source file
... that one. As obvious, pushed Dominique's trunk r270390/commit
ef9387d8fe79219a106c3f9d6c6a87b0a9065d54 to releases/gcc-8 in
8e55f241ab8c754a2ab8ec2fe39afd9173589401 "pr89358_0.C: Replace dg-* with
dg-lto-*.", see attached.
Grüße
Thomas
>> PR lto/89358
>> * g++.dg/lto/pr89358_0.C: New testcase.
>> * g++.dg/lto/pr89358_1.C: New testcase.
>> * ipa-devirt.c (skip_in_fields_list_p): New.
>> (odr_types_equivalent_p): Use it.
>> Index: testsuite/g++.dg/lto/pr89358_0.C
>> ===================================================================
>> --- testsuite/g++.dg/lto/pr89358_0.C (nonexistent)
>> +++ testsuite/g++.dg/lto/pr89358_0.C (working copy)
>> @@ -0,0 +1,11 @@
>> +/* { dg-do link } */
>> +/* { dg-options "-std=c++17" } */
>> +#include <map>
>> +
>> +extern void test();
>> +
>> +int main()
>> +{
>> + std::map<int, int> m;
>> + test();
>> +}
>> Index: testsuite/g++.dg/lto/pr89358_1.C
>> ===================================================================
>> --- testsuite/g++.dg/lto/pr89358_1.C (nonexistent)
>> +++ testsuite/g++.dg/lto/pr89358_1.C (working copy)
>> @@ -0,0 +1,7 @@
>> +/* { dg-options "-std=c++14" } */
>> +#include <map>
>> +
>> +void test()
>> +{
>> + std::map<int, int> m;
>> +}
>> Index: ipa-devirt.c
>> ===================================================================
>> --- ipa-devirt.c (revision 270324)
>> +++ ipa-devirt.c (working copy)
>> @@ -1282,6 +1282,24 @@ warn_types_mismatch (tree t1, tree t2, l
>> inform (loc_t2, "the incompatible type is defined here");
>> }
>>
>> +/* Return true if T should be ignored in TYPE_FIELDS for ODR comparsion. */
>> +
>> +static bool
>> +skip_in_fields_list_p (tree t)
>> +{
>> + if (TREE_CODE (t) != FIELD_DECL)
>> + return true;
>> + /* C++ FE introduces zero sized fields depending on -std setting, see
>> + PR89358. */
>> + if (DECL_SIZE (t)
>> + && integer_zerop (DECL_SIZE (t))
>> + && DECL_ARTIFICIAL (t)
>> + && DECL_IGNORED_P (t)
>> + && !DECL_NAME (t))
>> + return true;
>> + return false;
>> +}
>> +
>> /* Compare T1 and T2, report ODR violations if WARN is true and set
>> WARNED to true if anything is reported. Return true if types match.
>> If true is returned, the types are also compatible in the sense of
>> @@ -1548,9 +1566,9 @@ odr_types_equivalent_p (tree t1, tree t2
>> f1 = TREE_CHAIN (f1), f2 = TREE_CHAIN (f2))
>> {
>> /* Skip non-fields. */
>> - while (f1 && TREE_CODE (f1) != FIELD_DECL)
>> + while (f1 && skip_in_fields_list_p (f1))
>> f1 = TREE_CHAIN (f1);
>> - while (f2 && TREE_CODE (f2) != FIELD_DECL)
>> + while (f2 && skip_in_fields_list_p (f2))
>> f2 = TREE_CHAIN (f2);
>> if (!f1 || !f2)
>> break;
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-pr89358_0.C-Replace-dg-with-dg-lto.gcc-8.patch --]
[-- Type: text/x-diff, Size: 1465 bytes --]
From 8e55f241ab8c754a2ab8ec2fe39afd9173589401 Mon Sep 17 00:00:00 2001
From: Dominique d'Humieres <dominiq@gcc.gnu.org>
Date: Tue, 16 Apr 2019 15:24:58 +0200
Subject: [PATCH] pr89358_0.C: Replace dg-* with dg-lto-*.
2019-04-16 Dominique d'Humieres <dominiq@gcc.gnu.org>
* g++.dg/lto/pr89358_0.C: Replace dg-* with dg-lto-*.
(cherry picked from trunk r270390/commit ef9387d8fe79219a106c3f9d6c6a87b0a9065d54)
---
gcc/testsuite/ChangeLog | 7 +++++++
gcc/testsuite/g++.dg/lto/pr89358_0.C | 4 ++--
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 6c2c5559b9b5..1d0ed10a84ac 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2020-01-23 Thomas Schwinge <thomas@codesourcery.com>
+
+ Backport:
+ 2019-04-16 Dominique d'Humieres <dominiq@gcc.gnu.org>
+
+ * g++.dg/lto/pr89358_0.C: Replace dg-* with dg-lto-*.
+
2020-01-22 Joseph Myers <joseph@codesourcery.com>
Backport from mainline:
diff --git a/gcc/testsuite/g++.dg/lto/pr89358_0.C b/gcc/testsuite/g++.dg/lto/pr89358_0.C
index aebd2127c0cf..328c60c2fb18 100644
--- a/gcc/testsuite/g++.dg/lto/pr89358_0.C
+++ b/gcc/testsuite/g++.dg/lto/pr89358_0.C
@@ -1,5 +1,5 @@
-/* { dg-do link } */
-/* { dg-options "-std=c++17" } */
+/* { dg-lto-do link } */
+/* { dg-lto-options "-std=c++17" } */
#include <map>
extern void test();
--
2.17.1
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 658 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Fix false -Wodr warnings
@ 2019-04-15 6:48 Jan Hubicka
2019-04-15 12:06 ` Richard Biener
0 siblings, 1 reply; 8+ messages in thread
From: Jan Hubicka @ 2019-04-15 6:48 UTC (permalink / raw)
To: gcc-patches
Hi,
this patch fixes false warning that is output when different -std
settings are used. In this case C++ FE produces same declaration in
different representations which differ by 0 sized fileds only.
The patch makes them to be ignored (and I checked we ignore them for
canonical type merging too)
Bootstrapped/regtested x86_64-linux, comitted.
Honza
PR lto/89358
* g++.dg/lto/pr89358_0.C: New testcase.
* g++.dg/lto/pr89358_1.C: New testcase.
* ipa-devirt.c (skip_in_fields_list_p): New.
(odr_types_equivalent_p): Use it.
Index: testsuite/g++.dg/lto/pr89358_0.C
===================================================================
--- testsuite/g++.dg/lto/pr89358_0.C (nonexistent)
+++ testsuite/g++.dg/lto/pr89358_0.C (working copy)
@@ -0,0 +1,11 @@
+/* { dg-do link } */
+/* { dg-options "-std=c++17" } */
+#include <map>
+
+extern void test();
+
+int main()
+{
+ std::map<int, int> m;
+ test();
+}
Index: testsuite/g++.dg/lto/pr89358_1.C
===================================================================
--- testsuite/g++.dg/lto/pr89358_1.C (nonexistent)
+++ testsuite/g++.dg/lto/pr89358_1.C (working copy)
@@ -0,0 +1,7 @@
+/* { dg-options "-std=c++14" } */
+#include <map>
+
+void test()
+{
+ std::map<int, int> m;
+}
Index: ipa-devirt.c
===================================================================
--- ipa-devirt.c (revision 270324)
+++ ipa-devirt.c (working copy)
@@ -1282,6 +1282,24 @@ warn_types_mismatch (tree t1, tree t2, l
inform (loc_t2, "the incompatible type is defined here");
}
+/* Return true if T should be ignored in TYPE_FIELDS for ODR comparsion. */
+
+static bool
+skip_in_fields_list_p (tree t)
+{
+ if (TREE_CODE (t) != FIELD_DECL)
+ return true;
+ /* C++ FE introduces zero sized fields depending on -std setting, see
+ PR89358. */
+ if (DECL_SIZE (t)
+ && integer_zerop (DECL_SIZE (t))
+ && DECL_ARTIFICIAL (t)
+ && DECL_IGNORED_P (t)
+ && !DECL_NAME (t))
+ return true;
+ return false;
+}
+
/* Compare T1 and T2, report ODR violations if WARN is true and set
WARNED to true if anything is reported. Return true if types match.
If true is returned, the types are also compatible in the sense of
@@ -1548,9 +1566,9 @@ odr_types_equivalent_p (tree t1, tree t2
f1 = TREE_CHAIN (f1), f2 = TREE_CHAIN (f2))
{
/* Skip non-fields. */
- while (f1 && TREE_CODE (f1) != FIELD_DECL)
+ while (f1 && skip_in_fields_list_p (f1))
f1 = TREE_CHAIN (f1);
- while (f2 && TREE_CODE (f2) != FIELD_DECL)
+ while (f2 && skip_in_fields_list_p (f2))
f2 = TREE_CHAIN (f2);
if (!f1 || !f2)
break;
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Fix false -Wodr warnings
2019-04-15 6:48 Jan Hubicka
@ 2019-04-15 12:06 ` Richard Biener
0 siblings, 0 replies; 8+ messages in thread
From: Richard Biener @ 2019-04-15 12:06 UTC (permalink / raw)
To: Jan Hubicka; +Cc: GCC Patches
On Sun, Apr 14, 2019 at 10:59 PM Jan Hubicka <hubicka@ucw.cz> wrote:
>
> Hi,
> this patch fixes false warning that is output when different -std
> settings are used. In this case C++ FE produces same declaration in
> different representations which differ by 0 sized fileds only.
> The patch makes them to be ignored (and I checked we ignore them for
> canonical type merging too)
>
> Bootstrapped/regtested x86_64-linux, comitted.
The testcase is bogus
WARNING: lto.exp does not support dg-do
WARNING: lto.exp does not support dg-options in primary source file
> Honza
>
> PR lto/89358
> * g++.dg/lto/pr89358_0.C: New testcase.
> * g++.dg/lto/pr89358_1.C: New testcase.
> * ipa-devirt.c (skip_in_fields_list_p): New.
> (odr_types_equivalent_p): Use it.
> Index: testsuite/g++.dg/lto/pr89358_0.C
> ===================================================================
> --- testsuite/g++.dg/lto/pr89358_0.C (nonexistent)
> +++ testsuite/g++.dg/lto/pr89358_0.C (working copy)
> @@ -0,0 +1,11 @@
> +/* { dg-do link } */
> +/* { dg-options "-std=c++17" } */
> +#include <map>
> +
> +extern void test();
> +
> +int main()
> +{
> + std::map<int, int> m;
> + test();
> +}
> Index: testsuite/g++.dg/lto/pr89358_1.C
> ===================================================================
> --- testsuite/g++.dg/lto/pr89358_1.C (nonexistent)
> +++ testsuite/g++.dg/lto/pr89358_1.C (working copy)
> @@ -0,0 +1,7 @@
> +/* { dg-options "-std=c++14" } */
> +#include <map>
> +
> +void test()
> +{
> + std::map<int, int> m;
> +}
> Index: ipa-devirt.c
> ===================================================================
> --- ipa-devirt.c (revision 270324)
> +++ ipa-devirt.c (working copy)
> @@ -1282,6 +1282,24 @@ warn_types_mismatch (tree t1, tree t2, l
> inform (loc_t2, "the incompatible type is defined here");
> }
>
> +/* Return true if T should be ignored in TYPE_FIELDS for ODR comparsion. */
> +
> +static bool
> +skip_in_fields_list_p (tree t)
> +{
> + if (TREE_CODE (t) != FIELD_DECL)
> + return true;
> + /* C++ FE introduces zero sized fields depending on -std setting, see
> + PR89358. */
> + if (DECL_SIZE (t)
> + && integer_zerop (DECL_SIZE (t))
> + && DECL_ARTIFICIAL (t)
> + && DECL_IGNORED_P (t)
> + && !DECL_NAME (t))
> + return true;
> + return false;
> +}
> +
> /* Compare T1 and T2, report ODR violations if WARN is true and set
> WARNED to true if anything is reported. Return true if types match.
> If true is returned, the types are also compatible in the sense of
> @@ -1548,9 +1566,9 @@ odr_types_equivalent_p (tree t1, tree t2
> f1 = TREE_CHAIN (f1), f2 = TREE_CHAIN (f2))
> {
> /* Skip non-fields. */
> - while (f1 && TREE_CODE (f1) != FIELD_DECL)
> + while (f1 && skip_in_fields_list_p (f1))
> f1 = TREE_CHAIN (f1);
> - while (f2 && TREE_CODE (f2) != FIELD_DECL)
> + while (f2 && skip_in_fields_list_p (f2))
> f2 = TREE_CHAIN (f2);
> if (!f1 || !f2)
> break;
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2020-01-23 13:46 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-16 12:51 Fix false -Wodr warnings Dominique d'Humières
2019-04-16 12:55 ` Jan Hubicka
2019-04-16 13:02 ` Richard Biener
2019-04-16 13:08 ` Jakub Jelinek
2019-04-16 14:18 ` Dominique d'Humières
2020-01-23 13:53 ` Thomas Schwinge
-- strict thread matches above, loose matches on Subject: below --
2019-04-15 6:48 Jan Hubicka
2019-04-15 12:06 ` 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).