Update concepts branch to revision 131834
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / ssa-ccp-9.c
blobaf23f8bebd962973fcd7590ddd0f20b6379ebef1
1 /* { dg-do compile } */
2 /* { dg-options "-O1 -fdump-tree-optimized" } */
4 /* Check that cprop works for assignments to array elements and structs. */
6 struct foo {
7 int a;
8 };
10 extern void link_error (void);
12 void
13 test9 (struct foo f)
15 f.a = 0;
16 if (f.a != 0)
17 link_error ();
20 void
21 test99 (struct foo *f)
23 f->a = 0;
24 if (f->a != 0)
25 link_error ();
28 void
29 test999 (int *arr)
31 *arr = 0;
32 if (*arr != 0)
33 link_error ();
36 void
37 test9999 (int *arr)
39 arr[13] = 0;
40 if (arr[13] != 0)
41 link_error ();
44 void
45 test99999 (int *arr, int j)
47 arr[j] = 0;
48 if (arr[j] != 0)
49 link_error ();
52 /* There should be no link_error calls, if there is any, the
53 optimization has failed */
54 /* { dg-final { scan-tree-dump-times "link_error" 0 "optimized"} } */
55 /* { dg-final { cleanup-tree-dump "optimized" } } */