| 1 |
/* { dg-require-effective-target int32 } */ |
| 2 |
/* { dg-require-effective-target lp64 } */ |
| 3 |
|
| 4 |
/* Type mismatch: expect long, but passed an int. */ |
| 5 |
|
| 6 |
static void __attribute__((noinline)) |
| 7 |
__analyzer_consume_long (int placeholder, ...) |
| 8 |
{ |
| 9 |
long v; |
| 10 |
__builtin_va_list ap; |
| 11 |
__builtin_va_start (ap, placeholder); |
| 12 |
v = __builtin_va_arg (ap, long); /* { dg-warning "'va_arg' expected 'long int' but received 'int' for variadic argument 1 of 'ap'" } */ |
| 13 |
__builtin_va_end (ap); |
| 14 |
} |
| 15 |
|
| 16 |
void test_int_to_long (void) |
| 17 |
{ |
| 18 |
__analyzer_consume_long (42, 1066); |
| 19 |
} |
| 20 |
|
| 21 |
void test_char_to_long (void) |
| 22 |
{ |
| 23 |
/* char promoted to int. */ |
| 24 |
__analyzer_consume_long (42, 'a'); |
| 25 |
} |