Debian Codegraph @

gcc/testsuite/gcc.dg/c23-attr-reproducible-1.c

raw
1 /* Test C23 reproducible attribute: valid uses. */
2 /* { dg-do compile } */
3 /* { dg-options "-std=c23 -pedantic-errors -O2 -fdump-tree-optimized" } */
4 /* { dg-final { scan-tree-dump-times " f1 \\\(\\\);" 2 "optimized" } } */
5 /* { dg-final { scan-tree-dump-times " f2 \\\(\\\);" 2 "optimized" } } */
6 /* { dg-final { scan-tree-dump-times " f3 \\\(42\\\);" 2 "optimized" } } */
7 /* { dg-final { scan-tree-dump-times " f5 \\\(42\\\);" 2 "optimized" } } */
8 /* { dg-final { scan-tree-dump-times " f7 \\\(42\\\);" 2 "optimized" } } */
9 /* { dg-final { scan-tree-dump-times " f8 \\\(42\\\);" 2 "optimized" } } */
10 /* { dg-final { scan-tree-dump-times " f9 \\\(42\\\);" 2 "optimized" } } */
11 /* { dg-final { scan-tree-dump-times " f3 \\\(-42\\\);" 2 "optimized" } } */
12 /* { dg-final { scan-tree-dump-times " f5 \\\(-42\\\);" 2 "optimized" } } */
13 /* { dg-final { scan-tree-dump-times " f7 \\\(-42\\\);" 2 "optimized" } } */
14 /* { dg-final { scan-tree-dump-times " f8 \\\(-42\\\);" 2 "optimized" } } */
15 /* { dg-final { scan-tree-dump-times " f9 \\\(-42\\\);" 2 "optimized" } } */
16 /* { dg-final { scan-tree-dump " f3 \\\(52\\\);" "optimized" } } */
17 /* { dg-final { scan-tree-dump-times " fp1\.\[0-9]*_\[0-9]* \\\(14\\\);" 2 "optimized" } } */
18
19 int f1 () [[reproducible]];
20 int f2 () [[reproducible]], f3 (int) [[__reproducible__]];
21 int f4 (int, int *restrict) [[reproducible]];
22 int f5 (int) [[reproducible]];
23 int f6 (int);
24 int (*fp1) (int) [[reproducible]] = f6;
25 typedef int ft1 (int) [[reproducible]];
26 typedef int ft2 (int);
27 extern typeof (f6) [[reproducible]] f7;
28 extern ft2 [[__reproducible__]] f8;
29 int f1 ();
30 int f9 (int);
31 int f9 (int) [[__reproducible__]];
32 extern int x;
33
34 int
35 f10 (int w) [[reproducible]]
36 {
37 return w + 42 + x;
38 }
39
40 int
41 f11 (int *restrict w, long long y[restrict static 1], int z) [[__reproducible__]]
42 {
43 w[0] = z + x;
44 w[1] = z + x + 1;
45 w[2] = z + x + 2;
46 *y = z + x + 3;
47 return z + 4 + f10 (-42);
48 }
49
50 int
51 g ()
52 {
53 int a = f1 () + f2 () + f3 (42) + f5 (42) + f7 (42) + f8 (42) + f9 (42);
54 int b = f1 () + f2 () + f3 (42) + f5 (42) + f7 (42) + f8 (42) + f9 (42);
55 int c = f3 (-42) + f5 (-42) + f7 (-42) + f8 (-42) + f9 (-42);
56 int d = f3 (-42) + f5 (-42) + f7 (-42) + f8 (-42) + f9 (-42);
57 int e = fp1 (14) + fp1 (14);
58 x++;
59 int f = f1 () + f2 () + f3 (42) + f5 (42) + f7 (42) + f8 (42) + f9 (42);
60 int g = f1 () + f2 () + f3 (42) + f5 (42) + f7 (42) + f8 (42) + f9 (42);
61 int h = f3 (-42) + f5 (-42) + f7 (-42) + f8 (-42) + f9 (-42);
62 int i = f3 (-42) + f5 (-42) + f7 (-42) + f8 (-42) + f9 (-42);
63 int j = fp1 (14) + fp1 (14);
64 return a + b + c + d + e + f + g + h + i + j;
65 }
66
67 int
68 h ()
69 {
70 f3 (52);
71 f3 (52);
72 f3 (52);
73 return 0;
74 }