c++: prvalue of array type [PR111286]
[official-gcc.git] / gcc / testsuite / c-c++-common / spec-barrier-1.c
blobe4b44f2af57f15a2a0e096ca0b4c5928ae41ebed
1 /* { dg-do run } */
2 /* { dg-options "-O" } */
4 /* Test that __builtin_speculation_safe_value returns the correct value. */
5 /* This test will cause an unfiltered warning to be emitted on targets
6 that have not implemented support for speculative execution
7 barriers. They should fix that rather than disabling this
8 test. */
9 char a = 1;
10 short b = 2;
11 int c = 3;
12 long d = 4;
13 long long e = 5;
14 int *f = (int*) &c;
15 #ifdef __SIZEOF_INT128__
16 __int128 g = 9;
17 #endif
19 int main ()
21 if (__builtin_speculation_safe_value (a) != 1)
22 __builtin_abort ();
23 if (__builtin_speculation_safe_value (b) != 2)
24 __builtin_abort ();
25 if (__builtin_speculation_safe_value (c) != 3)
26 __builtin_abort ();
27 if (__builtin_speculation_safe_value (d) != 4)
28 __builtin_abort ();
29 if (__builtin_speculation_safe_value (e) != 5)
30 __builtin_abort ();
31 if (__builtin_speculation_safe_value (f) != &c)
32 __builtin_abort ();
33 #ifdef __SIZEOF_INT128__
34 if (__builtin_speculation_safe_value (g) != 9)
35 __builtin_abort ();
36 #endif
37 return 0;