Skip to content

Commit d1e7f3a

Browse files
committed
Add an alternative testcase for PR 70740
While looking into improving phiprop, I noticed that the current pr70740.c testcase was being optimized almost all the way before phiprop because the addresses were considered the same; the arrays were all zero in size. This adds an alternative testcase which changes the array sizes to be 1 and phiprop can and will act on this testcase now and the fix which was being tested is actually tested now. Tested on x86_64-linux-gnu. PR tree-optimization/70740 gcc/testsuite/ChangeLog: * gcc.dg/torture/pr70740-1.c: New test. Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
1 parent 6c5543d commit d1e7f3a

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/* { dg-do compile } */
2+
3+
/* This is an alternative to the original pr70740.c testcase,
4+
arrays are now 1 in size where they were 0 in the other testcase. */
5+
6+
extern int foo (void);
7+
extern void *memcpy (void *, const void *, __SIZE_TYPE__);
8+
9+
struct
10+
{
11+
char a[6];
12+
} d;
13+
struct
14+
{
15+
int a1[1];
16+
int a2[1];
17+
int a3[1];
18+
int a4[1];
19+
} a, c;
20+
int b;
21+
22+
int *
23+
bar ()
24+
{
25+
if (b)
26+
return a.a4;
27+
return a.a2;
28+
}
29+
30+
void
31+
baz ()
32+
{
33+
int *e, *f;
34+
if (foo ())
35+
e = c.a3;
36+
else
37+
e = c.a1;
38+
memcpy (d.a, e, 6);
39+
f = bar ();
40+
memcpy (d.a, f, 1);
41+
}

0 commit comments

Comments
 (0)