<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Passing double to isnan() triggers -Wconversion"
href="https://bugs.llvm.org/show_bug.cgi?id=39738">39738</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Passing double to isnan() triggers -Wconversion
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Frontend
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>sylvestre@debian.org
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>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 <a href="https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=914201">https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=914201</a></pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>