* gcc.dg/stack-check-5.c: Skip with -fstack-protector.
[official-gcc.git] / gcc / testsuite / gcc.dg / pr70859.c
blobe71b05237b080258c3f0c52ffdf08fd354e399d5
1 /* PR c/70859 */
2 /* { dg-do compile } */
4 static void *p;
5 static double *d;
6 static int r;
7 __extension__ static _Bool b;
9 void
10 fn0 (int n)
12 p = __builtin_alloca_with_align (n, 6); /* { dg-error "39:must be a constant integer" } */
14 r += __builtin_isfinite (0); /* { dg-error "28:non-floating-point argument in call" } */
15 r += __builtin_isinf (0); /* { dg-error "25:non-floating-point argument in call" } */
16 r += __builtin_isinf_sign (0); /* { dg-error "30:non-floating-point argument in call" } */
17 r += __builtin_isnan (0); /* { dg-error "25:non-floating-point argument in call" } */
18 r += __builtin_isnormal (0); /* { dg-error "28:non-floating-point argument in call" } */
19 r += __builtin_signbit (0); /* { dg-error "27:non-floating-point argument in call" } */
21 r += __builtin_isgreater (0, 0); /* { dg-error "8:non-floating-point arguments in call to function" } */
22 r += __builtin_isgreaterequal (0, 0); /* { dg-error "8:non-floating-point arguments in call to function" } */
23 r += __builtin_isless (0, 0); /* { dg-error "8:non-floating-point arguments in call to function" } */
24 r += __builtin_islessequal (0, 0); /* { dg-error "8:non-floating-point arguments in call to function" } */
25 r += __builtin_islessgreater (0, 0); /* { dg-error "8:non-floating-point arguments in call to function" } */
26 r += __builtin_isunordered (0, 0); /* { dg-error "8:non-floating-point arguments in call to function" } */
28 r += __builtin_fpclassify (1, 2, n, 4, 5, n); /* { dg-error "36:non-const integer argument 3 in call" } */
29 r += __builtin_fpclassify (1, 2, 3, 4, 5, 6); /* { dg-error "45:non-floating-point argument in call" } */
31 d = __builtin_assume_aligned (p, n, p); /* { dg-error "39:non-integer argument 3 in call" } */
33 b = __builtin_add_overflow (n, *d, &r); /* { dg-error "34:argument 2 in call to function" } */
34 b = __builtin_add_overflow (n, 5, d); /* { dg-error "37:argument 3 in call" } */
35 b = __builtin_sub_overflow (n, *d, &r); /* { dg-error "34:argument 2 in call to function" } */
36 b = __builtin_sub_overflow (n, 5, d); /* { dg-error "37:argument 3 in call" } */
37 b = __builtin_mul_overflow (n, *d, &r); /* { dg-error "34:argument 2 in call to function" } */
38 b = __builtin_mul_overflow (n, 5, d); /* { dg-error "37:argument 3 in call" } */
41 int
42 fn1 (void)
44 if (__builtin_constant_p ()) /* { dg-error "7:too few" } */
45 return 0;
46 if (__builtin_constant_p (1, 2)) /* { dg-error "7:too many" } */
47 return 1;
48 if (__builtin_isfinite ()) /* { dg-error "7:too few" } */
49 return 3;
50 if (__builtin_isfinite (1, 2)) /* { dg-error "7:too many" } */
51 return 4;
52 if (__builtin_isless (0)) /* { dg-error "7:too few" } */
53 return 5;
54 if (__builtin_isless (1, 2, 3)) /* { dg-error "7:too many" } */
55 return 6;
56 if (__builtin_fpclassify (1, 2, 3, 4, 5)) /* { dg-error "7:too few" } */
57 return 7;
58 if (__builtin_fpclassify (1, 2, 3, 4, 5, r, 6)) /* { dg-error "7:too many" } */
59 return 8;
60 if (__builtin_assume_aligned (p)) /* { dg-error "7:too few" } */
61 return 9;
62 if (__builtin_assume_aligned (p, r, p, p)) /* { dg-error "7:too many" } */
63 return 10;
64 if (__builtin_add_overflow ()) /* { dg-error "7:too few" } */
65 return 11;
66 if (__builtin_add_overflow (1, 2, 3, &r)) /* { dg-error "7:too many" } */
67 return 12;
68 return -1;