1 /* { dg-do compile } */
2
3 struct X { int x; };
4
test1(struct X x)5 int test1(struct X x)
6 {
7 if (x.x == 1) return __builtin_fpclassify(1,2,3,4,5,x); /* { dg-error "non-floating-point argument" } */
8 if (x.x == 2) return __builtin_isfinite(x); /* { dg-error "non-floating-point argument" } */
9 if (x.x == 3) return __builtin_isinf_sign(x); /* { dg-error "non-floating-point argument" } */
10 if (x.x == 4) return __builtin_isinf(x); /* { dg-error "non-floating-point argument" } */
11 if (x.x == 5) return __builtin_isnan(x); /* { dg-error "non-floating-point argument" } */
12 if (x.x == 6) return __builtin_isnormal(x); /* { dg-error "non-floating-point argument" } */
13 if (x.x == 7) return __builtin_isgreater(x, x); /* { dg-error "non-floating-point arguments" } */
14 if (x.x == 8) return __builtin_isgreaterequal(x, x); /* { dg-error "non-floating-point arguments" } */
15 if (x.x == 9) return __builtin_isless(x, x); /* { dg-error "non-floating-point arguments" } */
16 if (x.x == 10) return __builtin_islessequal(x, x); /* { dg-error "non-floating-point arguments" } */
17 if (x.x == 11) return __builtin_islessgreater(x, x); /* { dg-error "non-floating-point arguments" } */
18 if (x.x == 12) return __builtin_isunordered(x, x); /* { dg-error "non-floating-point arguments" } */
19 if (x.x == 13) return __builtin_signbit(x); /* { dg-error "non-floating-point argument" } */
20
21 return 0;
22 }
23
test2(double x)24 int test2(double x)
25 {
26 if (x == 1) return __builtin_fpclassify(1,2,3,4,5); /* { dg-error "too few arguments" } */
27 if (x == 2) return __builtin_isfinite(); /* { dg-error "too few arguments" } */
28 if (x == 3) return __builtin_isinf_sign(); /* { dg-error "too few arguments" } */
29 if (x == 4) return __builtin_isinf(); /* { dg-error "too few arguments" } */
30 if (x == 5) return __builtin_isnan(); /* { dg-error "too few arguments" } */
31 if (x == 6) return __builtin_isnormal(); /* { dg-error "too few arguments" } */
32 if (x == 7) return __builtin_isgreater(x); /* { dg-error "too few arguments" } */
33 if (x == 8) return __builtin_isgreaterequal(x); /* { dg-error "too few arguments" } */
34 if (x == 9) return __builtin_isless(x); /* { dg-error "too few arguments" } */
35 if (x == 10) return __builtin_islessequal(x); /* { dg-error "too few arguments" } */
36 if (x == 11) return __builtin_islessgreater(x); /* { dg-error "too few arguments" } */
37 if (x == 12) return __builtin_isunordered(x); /* { dg-error "too few arguments" } */
38 if (x == 13) return __builtin_signbit(); /* { dg-error "too few arguments" } */
39 return 0;
40 }
41
test3(double x)42 int test3(double x)
43 {
44 if (x == 1) return __builtin_fpclassify(1,2,3,4,5,x,x); /* { dg-error "too many arguments" } */
45 if (x == 2) return __builtin_isfinite(x, x); /* { dg-error "too many arguments" } */
46 if (x == 3) return __builtin_isinf_sign(x, x); /* { dg-error "too many arguments" } */
47 if (x == 4) return __builtin_isinf(x, x); /* { dg-error "too many arguments" } */
48 if (x == 5) return __builtin_isnan(x, x); /* { dg-error "too many arguments" } */
49 if (x == 6) return __builtin_isnormal(x, x); /* { dg-error "too many arguments" } */
50 if (x == 7) return __builtin_isgreater(x, x, x); /* { dg-error "too many arguments" } */
51 if (x == 8) return __builtin_isgreaterequal(x, x, x); /* { dg-error "too many arguments" } */
52 if (x == 9) return __builtin_isless(x, x, x); /* { dg-error "too many arguments" } */
53 if (x == 10) return __builtin_islessequal(x, x, x); /* { dg-error "too many arguments" } */
54 if (x == 11) return __builtin_islessgreater(x, x, x); /* { dg-error "too many arguments" } */
55 if (x == 12) return __builtin_isunordered(x, x, x); /* { dg-error "too many arguments" } */
56 if (x == 13) return __builtin_signbit(x, x); /* { dg-error "too many arguments" } */
57 return 0;
58 }
59
test4(int i,double x)60 int test4(int i, double x)
61 {
62 if (x == 1) return __builtin_fpclassify(i,2,3,4,5,x); /* { dg-error "non-const integer argument" } */
63 if (x == 2) return __builtin_fpclassify(1,i,3,4,5,x); /* { dg-error "non-const integer argument" } */
64 if (x == 3) return __builtin_fpclassify(1,2,i,4,5,x); /* { dg-error "non-const integer argument" } */
65 if (x == 4) return __builtin_fpclassify(1,2,3,i,5,x); /* { dg-error "non-const integer argument" } */
66 if (x == 5) return __builtin_fpclassify(1,2,3,4,i,x); /* { dg-error "non-const integer argument" } */
67 return 0;
68 }
69