Bug#914201: clang-7: Passing double to isnan() triggers -Wconversion

James McCoy jamessan at debian.org
Tue Nov 20 15:32:36 GMT 2018


Package: clang-7
Version: 1:7.0.1~+rc2-4
Severity: normal
Tags: upstream

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

-- System Information:
Debian Release: buster/sid
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.18.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages clang-7 depends on:
ii  binutils               2.31.1-7
ii  libc6                  2.27-8
ii  libc6-dev              2.27-8
ii  libclang-common-7-dev  1:7.0.1~+rc2-4
ii  libclang1-7            1:7.0.1~+rc2-4
ii  libgcc-8-dev           8.2.0-9
ii  libgcc1                1:8.2.0-9
ii  libllvm7               1:7.0.1~+rc2-4
ii  libobjc-8-dev          8.2.0-9
ii  libstdc++-8-dev        8.2.0-9
ii  libstdc++6             8.2.0-9

Versions of packages clang-7 recommends:
ii  libomp-7-dev  1:7.0.1~+rc2-4
ii  llvm-7-dev    1:7.0.1~+rc2-4
ii  python        2.7.15-3

Versions of packages clang-7 suggests:
pn  clang-7-doc  <none>

-- no debconf information



More information about the Pkg-llvm-team mailing list