2007-11-14 02:37:02 +08:00
|
|
|
// RUN: clang -fsyntax-only -Wfloat-equal -verify %s
|
2007-08-30 02:06:12 +08:00
|
|
|
|
2007-11-29 09:00:11 +08:00
|
|
|
int f1(float x, float y) {
|
2007-08-30 02:06:12 +08:00
|
|
|
return x == y; // expected-warning {{comparing floating point with ==}}
|
|
|
|
}
|
|
|
|
|
2007-11-29 09:00:11 +08:00
|
|
|
int f2(float x, float y) {
|
2007-08-30 02:06:12 +08:00
|
|
|
return x != y; // expected-warning {{comparing floating point with ==}}
|
2007-09-27 04:14:22 +08:00
|
|
|
}
|
2007-10-30 00:40:01 +08:00
|
|
|
|
2007-11-29 09:00:11 +08:00
|
|
|
int f3(float x) {
|
2007-10-30 00:40:01 +08:00
|
|
|
return x == x; // no-warning
|
|
|
|
}
|
2007-11-14 03:17:00 +08:00
|
|
|
|
2007-11-29 09:00:11 +08:00
|
|
|
int f4(float x) {
|
2007-11-29 09:03:21 +08:00
|
|
|
return x == 0.0; // no-warning {{comparing}}
|
2007-11-14 03:17:00 +08:00
|
|
|
}
|
|
|
|
|
2007-11-29 09:00:11 +08:00
|
|
|
int f5(float x) {
|
2007-11-14 03:17:00 +08:00
|
|
|
return x == __builtin_inf(); // no-warning
|
2007-11-29 09:00:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
int f7(float x) {
|
|
|
|
return x == 3.14159; // expected-warning {{comparing}}
|
|
|
|
}
|