[LLVMbugs] [Bug 17000] New: clang sanitizer regards IEC 60559 floating-point division by zero as undefined

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Aug 26 06:35:08 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=17000

            Bug ID: 17000
           Summary: clang sanitizer regards IEC 60559 floating-point
                    division by zero as undefined
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: vincent-llvm at vinc17.net
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Annex F of the C standard (IEC 60559 / IEEE 754 support) defines the
floating-point division by zero, but clang (3.3 and 3.4 Debian snapshot)
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.

My Debian bug report: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=720935

-- 
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/20130826/63b490b4/attachment.html>


More information about the llvm-bugs mailing list