Debian Codegraph @

gcc/testsuite/c-c++-common/attr-unsequenced-2.c

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