OSDN Git Service

PR c/20740
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / builtin-protos-1.c
1 /* { dg-do compile } */
2 /* { dg-options -Wconversion } */
3
4 int
5 test_s (signed int x)
6 {
7   return __builtin_abs (x)      /* { dg-bogus "as unsigned due to prototype" } */
8     + __builtin_clz (x)         /* { dg-warning "as unsigned due to prototype" } */
9     + __builtin_ctz (x)         /* { dg-warning "as unsigned due to prototype" } */
10     + __builtin_ffs (x)         /* { dg-bogus "as unsigned due to prototype" } */
11     + __builtin_parity (x)      /* { dg-warning "as unsigned due to prototype" } */
12     + __builtin_popcount (x);   /* { dg-warning "as unsigned due to prototype" } */
13 }
14
15 int
16 test_u (unsigned int x)
17 {
18   return __builtin_abs (x)      /* { dg-warning "as signed due to prototype" } */
19     + __builtin_clz (x)         /* { dg-bogus "as signed due to prototype" } */
20     + __builtin_ctz (x)         /* { dg-bogus "as signed due to prototype" } */
21     + __builtin_ffs (x)         /* { dg-warning "as signed due to prototype" } */
22     + __builtin_parity (x)      /* { dg-bogus "as signed due to prototype" } */
23     + __builtin_popcount (x);   /* { dg-bogus "as signed due to prototype" } */
24 }
25
26 int
27 test_sl (signed long x)
28 {
29   return __builtin_labs (x)     /* { dg-bogus "as unsigned due to prototype" } */
30     + __builtin_clzl (x)        /* { dg-warning "as unsigned due to prototype" } */
31     + __builtin_ctzl (x)        /* { dg-warning "as unsigned due to prototype" } */
32     + __builtin_ffsl (x)        /* { dg-bogus "as unsigned due to prototype" } */
33     + __builtin_parityl (x)     /* { dg-warning "as unsigned due to prototype" } */
34     + __builtin_popcountl (x);  /* { dg-warning "as unsigned due to prototype" } */
35 }
36
37 int
38 test_ul (unsigned long x)
39 {
40   return __builtin_labs (x)     /* { dg-warning "as signed due to prototype" } */
41     + __builtin_clzl (x)        /* { dg-bogus "as signed due to prototype" } */
42     + __builtin_ctzl (x)        /* { dg-bogus "as signed due to prototype" } */
43     + __builtin_ffsl (x)        /* { dg-warning "as signed due to prototype" } */
44     + __builtin_parityl (x)     /* { dg-bogus "as signed due to prototype" } */
45     + __builtin_popcountl (x);  /* { dg-bogus "as signed due to prototype" } */
46 }
47
48 int
49 test_sll (signed long long x)
50 {
51   return __builtin_llabs (x)    /* { dg-bogus "as unsigned due to prototype" } */
52     + __builtin_clzll (x)       /* { dg-warning "as unsigned due to prototype" } */
53     + __builtin_ctzll (x)       /* { dg-warning "as unsigned due to prototype" } */
54     + __builtin_ffsll (x)       /* { dg-bogus "as unsigned due to prototype" } */
55     + __builtin_parityll (x)    /* { dg-warning "as unsigned due to prototype" } */
56     + __builtin_popcountll (x); /* { dg-warning "as unsigned due to prototype" } */
57 }
58
59 int
60 test_ull (unsigned long long x)
61 {
62   return __builtin_llabs (x)    /* { dg-warning "as signed due to prototype" } */
63     + __builtin_clzll (x)       /* { dg-bogus "as signed due to prototype" } */
64     + __builtin_ctzll (x)       /* { dg-bogus "as signed due to prototype" } */
65     + __builtin_ffsll (x)       /* { dg-warning "as signed due to prototype" } */
66     + __builtin_parityll (x)    /* { dg-bogus "as signed due to prototype" } */
67     + __builtin_popcountll (x); /* { dg-bogus "as signed due to prototype" } */
68 }