]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gcc.dg/tree-ssa/struct-aliasing-2.c
re PR middle-end/42834 (memcpy folding overeager)
[thirdparty/gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / struct-aliasing-2.c
1 /* { dg-do "compile" } */
2 /* { dg-options "-O2 -fdump-tree-fre" } */
3
4 struct S { unsigned f; };
5
6 int
7 foo ( struct S *p)
8 {
9 int *q = (int *)&p->f;
10 int i = *q;
11 return i + p->f;
12 }
13
14
15 /* There should only be one load of p->f because fwprop can change
16 *(int *)&p->f into just (int)p->f. */
17 /* { dg-final { scan-tree-dump-times "= \[^\n\]*p_.\\\(D\\\)" 1 "fre" } } */
18 /* { dg-final { cleanup-tree-dump "fre" } } */
19