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.
This commit is contained in:
Richard Biener 2023-01-18 14:54:33 +01:00
parent ddbe758b17
commit d4abe5c456
2 changed files with 23 additions and 0 deletions

View file

@ -0,0 +1,4 @@
/* { dg-lto-do link } */
/* { dg-lto-options { "-g -O2 -flto" } } */
int gArray[16];

View file

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