public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-5242] lto/108445 - avoid LTO decl wrapping being confused by tree sharing
@ 2023-01-18 13:57 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2023-01-18 13:57 UTC (permalink / raw)
  To: gcc-cvs

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;
+}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-01-18 13:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-18 13:57 [gcc r13-5242] lto/108445 - avoid LTO decl wrapping being confused by tree sharing 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).