floating-point-compare.c revision c8f488d1c851fddeb7754d0c9cf98045b17da535
1// RUN: clang -fsyntax-only -Wfloat-equal -verify %s 2 3int foo(float x, float y) { 4 return x == y; // expected-warning {{comparing floating point with ==}} 5} 6 7int bar(float x, float y) { 8 return x != y; // expected-warning {{comparing floating point with ==}} 9} 10 11int qux(float x) { 12 return x == x; // no-warning 13} 14 15int baz(float x) { 16 return x == 0.0; // no-warning 17} 18 19int taz(float x) { 20 return x == __builtin_inf(); // no-warning 21}