[llvm-bugs] [Bug 39738] New: Passing double to isnan() triggers -Wconversion
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Nov 21 00:04:54 PST 2018
https://bugs.llvm.org/show_bug.cgi?id=39738
Bug ID: 39738
Summary: Passing double to isnan() triggers -Wconversion
Product: clang
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Frontend
Assignee: unassignedclangbugs at nondot.org
Reporter: sylvestre at debian.org
CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
richard-llvm at metafoo.co.uk
Given this simple program:
-- >8 --
#include <math.h>
int main(void)
{
double f = 2.0;
if (isnan(f))
return 1;
return 0;
}
-- >8 --
we get conversion warnings when using clang, but not gcc. This is
particularly annoying when trying to keep a project warning free and
using -Werror.
$ clang -Wconversion -o foo foo.c
foo.c:7:12: warning: implicit conversion loses floating-point precision:
'double' to 'float' [-Wconversion]
if (isnan(f))
~~~~~~^~
/usr/include/math.h:644:46: note: expanded from macro 'isnan'
# define isnan(x) __MATH_TG ((x), __isnan, (x))
~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/math.h:559:16: note: expanded from macro '__MATH_TG'
? FUNC ## f ARGS \
~~~~~~~~~ ^~~~
1 warning generated.
$ gcc -Wconversion -o foo foo.c
reported https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=914201
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20181121/d7773f23/attachment.html>
More information about the llvm-bugs
mailing list