Bug#720935: clang-3.3: sanitizer regards IEC 60559 division by zero as undefined

Vincent Lefevre vincent at vinc17.net
Mon Aug 26 12:46:47 UTC 2013


Package: clang-3.3
Version: 1:3.3-8
Severity: normal

Annex F of the C standard (IEC 60559 / IEEE 754 support) defines the
floating-point division by zero, but clang regards it as undefined.
This is incorrect: with

#include <stdio.h>

int main(void)
{
  volatile double d;
#if __STDC_IEC_559__
  d = 1.0 / 0.0;
  printf ("%g\n", d);
#endif
  return 0;
}

I get the following error:

ypig:~> clang tst.c -o tst -fsanitize=undefined -fno-sanitize-recover
ypig:~> ./tst
tst.c:7:11: runtime error: division by zero
zsh: exit 1     ./tst

When IEC 60559 is supported, "float-divide-by-zero" shouldn't be part
of "undefined". A user would would like to check division by zero
could either check the corresponding exception or explicitly add
"float-divide-by-zero" to -fsanitize.

-- System Information:
Debian Release: jessie/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.10-2-amd64 (SMP w/8 CPU cores)
Locale: LANG=POSIX, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages clang-3.3 depends on:
ii  libc6                    2.17-92
ii  libclang-common-3.3-dev  1:3.3-8
ii  libclang1-3.3            1:3.3-8
ii  libffi6                  3.0.13-4
ii  libgcc-4.7-dev           4.7.3-7
ii  libgcc1                  1:4.8.1-9
ii  libllvm3.3               1:3.3-8
ii  libobjc-4.7-dev          4.7.3-7
ii  libstdc++6               4.8.1-9
ii  libstdc++6-4.7-dev       4.7.3-7

Versions of packages clang-3.3 recommends:
ii  llvm-3.3-dev  1:3.3-8
ii  python        2.7.5-4

clang-3.3 suggests no packages.

-- no debconf information



More information about the Pkg-llvm-team mailing list