public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Martin Liška" <mliska@suse.cz>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: GCC 8 backports
Date: Wed, 15 Jan 2020 10:15:00 -0000	[thread overview]
Message-ID: <c9b15424-cc92-d31d-7368-f57e795127a7@suse.cz> (raw)
In-Reply-To: <ba2054eb-5b7a-3c87-d498-5f462438fff7@suse.cz>

[-- Attachment #1: Type: text/plain, Size: 78 bytes --]

Hi.

There's one more backport commit I've just tested and installed.

Martin

[-- Attachment #2: 0001-Backport-d2a0371d2641e85c5e6ca396029be32204d976df.patch --]
[-- Type: text/x-patch, Size: 2993 bytes --]

From 67c0ee2c48a5e154bf00fa8326536881a92e287c Mon Sep 17 00:00:00 2001
From: Jan Hubicka <hubicka@ucw.cz>
Date: Sun, 14 Apr 2019 22:56:45 +0200
Subject: [PATCH] Backport d2a0371d2641e85c5e6ca396029be32204d976df

gcc/ChangeLog:

2019-04-14  Jan Hubicka  <hubicka@ucw.cz>

	PR lto/89358
	* ipa-devirt.c (skip_in_fields_list_p): New.
	(odr_types_equivalent_p): Use it.

gcc/testsuite/ChangeLog:

2019-04-14  Jan Hubicka  <hubicka@ucw.cz>

	PR lto/89358
	* g++.dg/lto/pr89358_0.C: New testcase.
	* g++.dg/lto/pr89358_1.C: New testcase.
---
 gcc/ipa-devirt.c                     | 22 ++++++++++++++++++++--
 gcc/testsuite/g++.dg/lto/pr89358_0.C | 11 +++++++++++
 gcc/testsuite/g++.dg/lto/pr89358_1.C |  7 +++++++
 3 files changed, 38 insertions(+), 2 deletions(-)
 create mode 100644 gcc/testsuite/g++.dg/lto/pr89358_0.C
 create mode 100644 gcc/testsuite/g++.dg/lto/pr89358_1.C

diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c
index 5b6b130fa3a..380102020f9 100644
--- a/gcc/ipa-devirt.c
+++ b/gcc/ipa-devirt.c
@@ -1241,6 +1241,24 @@ warn_types_mismatch (tree t1, tree t2, location_t loc1, location_t loc2)
     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
@@ -1525,9 +1543,9 @@ odr_types_equivalent_p (tree t1, tree t2, bool warn, bool *warned,
 		 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;
diff --git a/gcc/testsuite/g++.dg/lto/pr89358_0.C b/gcc/testsuite/g++.dg/lto/pr89358_0.C
new file mode 100644
index 00000000000..aebd2127c0c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/pr89358_0.C
@@ -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();
+}
diff --git a/gcc/testsuite/g++.dg/lto/pr89358_1.C b/gcc/testsuite/g++.dg/lto/pr89358_1.C
new file mode 100644
index 00000000000..68b80a37662
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/pr89358_1.C
@@ -0,0 +1,7 @@
+/* { dg-options "-std=c++14"  } */
+#include <map>
+
+void test()
+{
+        std::map<int, int> m;
+}
-- 
2.24.1


  parent reply	other threads:[~2020-01-15  9:47 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-23  8:43 Martin Liška
2018-08-16 10:14 ` Martin Liška
2018-09-18  9:37   ` Martin Liška
2018-09-25  6:52     ` Martin Liška
2018-10-03 10:09       ` Martin Liška
2018-11-20 10:58         ` Martin Liška
2018-12-27 14:59           ` Martin Liška
2018-12-28 11:46             ` Sudakshina Das
2019-01-02 11:46               ` Martin Liška
2019-01-02 11:50                 ` Jan Hubicka
2019-01-03  8:46                   ` Martin Liška
2019-02-14 11:23           ` Martin Liška
2019-02-14 13:57             ` Martin Liška
2019-03-11  9:39               ` Martin Liška
2019-03-15  8:39                 ` Martin Liška
2019-03-28  8:53                   ` Martin Liška
2019-05-24  7:42                     ` Martin Liška
2019-07-04 10:17                       ` Martin Liška
2020-01-15 10:15 ` Martin Liška [this message]
2020-03-02  9:33 ` Martin Liška
2020-03-29 17:17 ` Martin Liška
2020-04-03 10:32   ` Martin Liška
2019-05-06 14:00 Martin Liška
2019-05-14  9:11 ` Martin Liška
2019-07-22  9:36   ` Martin Liška
2019-05-07 16:17 Marek Polacek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c9b15424-cc92-d31d-7368-f57e795127a7@suse.cz \
    --to=mliska@suse.cz \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).