floating-point-compare.c revision a5728872c7702ddd09537c95bc3cbd20e1f2fb09
1// RUN: %clang_cc1 -fsyntax-only -Wfloat-equal -verify %s
2
3int f1(float x, float y) {
4  return x == y; // expected-warning {{comparing floating point with ==}}
5}
6
7int f2(float x, float y) {
8  return x != y; // expected-warning {{comparing floating point with ==}}
9}
10
11int f3(float x) {
12  return x == x; // no-warning
13}
14
15int f4(float x) {
16  return x == 0.0; // no-warning {{comparing}}
17}
18
19int f5(float x) {
20  return x == __builtin_inf(); // no-warning
21}
22
23int f7(float x) {
24  return x == 3.14159; // expected-warning {{comparing}}
25}
26