Ted Kremenek | 24f59fb | 2007-11-13 18:37:02 +0000 | [diff] [blame] | 1 | // RUN: clang -fsyntax-only -Wfloat-equal -verify %s |
Ted Kremenek | ec761af | 2007-08-29 18:06:12 +0000 | [diff] [blame] | 2 | |
| 3 | int foo(float x, float y) { |
| 4 | return x == y; // expected-warning {{comparing floating point with ==}} |
| 5 | } |
| 6 | |
| 7 | int bar(float x, float y) { |
| 8 | return x != y; // expected-warning {{comparing floating point with ==}} |
Ted Kremenek | 56b7086 | 2007-09-26 20:14:22 +0000 | [diff] [blame] | 9 | } |
Ted Kremenek | 7543914 | 2007-10-29 16:40:01 +0000 | [diff] [blame] | 10 | |
| 11 | int qux(float x) { |
| 12 | return x == x; // no-warning |
| 13 | } |
Ted Kremenek | 0d054eb | 2007-11-13 19:17:00 +0000 | [diff] [blame^] | 14 | |
| 15 | int baz(float x) { |
| 16 | return x == 0.0; // no-warning |
| 17 | } |
| 18 | |
| 19 | int taz(float x) { |
| 20 | return x == __builtin_inf(); // no-warning |
| 21 | } |