| 1 |
/* { dg-options "-fshow-column -Wall -Wfloat-equal -pedantic" } */ |
| 2 |
|
| 3 |
int i, j; |
| 4 |
float a, b; |
| 5 |
|
| 6 |
int *p; |
| 7 |
struct { |
| 8 |
int a; |
| 9 |
char b; |
| 10 |
} *q; |
| 11 |
|
| 12 |
extern void bar(); |
| 13 |
|
| 14 |
void foo (void) |
| 15 |
{ |
| 16 |
if (a == b) /* { dg-warning "9:comparing floating-point with" } */ |
| 17 |
bar (); |
| 18 |
|
| 19 |
if (p < q) /* { dg-warning "9:comparison of distinct pointer types" } */ |
| 20 |
bar (); |
| 21 |
|
| 22 |
if (&p == 0) /* { dg-warning "10:comparison will always evaluate as 'false'" } */ |
| 23 |
bar(); |
| 24 |
|
| 25 |
if (p == 4) /* { dg-warning "9:comparison between pointer and integer" } */ |
| 26 |
bar(); |
| 27 |
|
| 28 |
if (p < 0) /* { dg-warning "9:ordered comparison of pointer with" } */ |
| 29 |
bar(); |
| 30 |
|
| 31 |
-q; /* { dg-error "3:wrong type argument to unary" } */ |
| 32 |
|
| 33 |
~q; /* { dg-error "3:wrong type argument to bit" } */ |
| 34 |
|
| 35 |
++*q; /* { dg-error "3:wrong type argument to increment" } */ |
| 36 |
|
| 37 |
i = j / 0; /* { dg-warning "9:division by zero" } */ |
| 38 |
|
| 39 |
i /= 0; /* { dg-warning "5:division by zero" } */ |
| 40 |
} |