Fix all tests that fail with -sanitize=return.
[official-gcc.git] / gcc / testsuite / g++.dg / tree-ssa / restrict2.C
blob4f97360dc720fd16be14b03e65ed5b6a34fb4ad6
1 // { dg-do compile }
2 // { dg-options "-O2 -fdump-tree-optimized" }
4 struct S { int *__restrict p; int q; };
5 S s;
7 int
8 f1 (S x, S y)
10   x.p[0] = 1;
11   y.p[0] = 0;
12 // { dg-final { scan-tree-dump-times "return 1" 1 "optimized" } }
13   return x.p[0];
16 int
17 f2 (S x)
19   x.p[0] = 2;
20   s.p[0] = 0;
21 // { dg-final { scan-tree-dump-times "return 2" 1 "optimized" } }
22   return x.p[0];
25 int
26 f3 (S &__restrict x, S &__restrict y)
28   x.p[0] = 3;
29   y.p[0] = 0;
30 // { dg-final { scan-tree-dump-times "return 3" 1 "optimized" } }
31   return x.p[0];
34 int
35 f4 (S &x, S &y)
37   x.p[0] = 4;
38   y.p[0] = 0;
39 // { dg-final { scan-tree-dump-times "return 4" 0 "optimized" } }
40   return x.p[0];
43 int
44 f5 (S *__restrict x, S *__restrict y)
46   x->p[0] = 5;
47   y->p[0] = 0;
48 // { dg-final { scan-tree-dump-times "return 5" 1 "optimized" } }
49   return x->p[0];
52 int
53 f6 (S *x, S *y)
55   x->p[0] = 6;
56   y->p[0] = 0;
57 // { dg-final { scan-tree-dump-times "return 6" 0 "optimized" } }
58   return x->p[0];