public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Richard Biener <rguenth@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r13-5242] lto/108445 - avoid LTO decl wrapping being confused by tree sharing
Date: Wed, 18 Jan 2023 13:57:52 +0000 (GMT)	[thread overview]
Message-ID: <20230118135752.532FA385842E@sourceware.org> (raw)

https://gcc.gnu.org/g:d4abe5c456a3023f61c3e053255b7dd72ca0d7ec

commit r13-5242-gd4abe5c456a3023f61c3e053255b7dd72ca0d7ec
Author: Richard Biener <rguenther@suse.de>
Date:   Wed Jan 18 14:54:33 2023 +0100

    lto/108445 - avoid LTO decl wrapping being confused by tree sharing
    
    r13-4743 exposed more tree sharing which runs into a latent issue
    with LTO decl wrapping during streaming.  The following adds a
    testcase triggering the issue.
    
            PR lto/108445
            * gcc.dg/lto/pr108445_0.c: New testcase.
            * gcc.dg/lto/pr108445_1.c: Likewise.

Diff:
---
 gcc/testsuite/gcc.dg/lto/pr108445_0.c |  4 ++++
 gcc/testsuite/gcc.dg/lto/pr108445_1.c | 19 +++++++++++++++++++
 2 files changed, 23 insertions(+)

diff --git a/gcc/testsuite/gcc.dg/lto/pr108445_0.c b/gcc/testsuite/gcc.dg/lto/pr108445_0.c
new file mode 100644
index 00000000000..06dac691e84
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/pr108445_0.c
@@ -0,0 +1,4 @@
+/* { dg-lto-do link } */
+/* { dg-lto-options { "-g -O2 -flto" } } */
+
+int gArray[16];
diff --git a/gcc/testsuite/gcc.dg/lto/pr108445_1.c b/gcc/testsuite/gcc.dg/lto/pr108445_1.c
new file mode 100644
index 00000000000..50db9feb8a5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/pr108445_1.c
@@ -0,0 +1,19 @@
+extern int gArray[];
+
+int foo(int *a)
+{
+  int *p = a;
+
+  return *p;
+}
+
+int main(int argc, char *argv[])
+{
+  if (argc & 1)
+    gArray[argc - 1] = 1;
+
+  if (argc > 1)
+    return foo(gArray);
+
+  return 0;
+}

                 reply	other threads:[~2023-01-18 13:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20230118135752.532FA385842E@sourceware.org \
    --to=rguenth@gcc.gnu.org \
    --cc=gcc-cvs@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).