[cfe-dev] Warn on invalid fp-to-int conversions?

Krzysztof Parzyszek via cfe-dev cfe-dev at lists.llvm.org
Fri Jan 20 08:49:36 PST 2017


Hi,
Consider this program:

#include <math.h>
int foo() {
   int a = (int)INFINITY;
   int b = (int)NAN;
   return a+b;
}

It compiles without warnings (using -Wall), however neither of the 
conversions will result in anything useful. Would it be reasonable to 
have a warning about these kinds of conversions?

-Krzysztof

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, 
hosted by The Linux Foundation



More information about the cfe-dev mailing list