https://bugs.llvm.org/show_bug.cgi?id=45352

            Bug ID: 45352
           Summary: Undefined Behavior sanitizer finding for 1.0f / 0.0f
           Product: clang
           Version: 8.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
          Assignee: dcough...@apple.com
          Reporter: noloa...@gmail.com
                CC: dcough...@apple.com, llvm-bugs@lists.llvm.org

The following is producing an Undefined Behavior sanitizer finding:

    ASSERT(INFINITY == 1.0f / 0.0f);

After a quick read of IEEE 754, it looks like that is conforming behavior for
floats. According the IEEE 754, conforming behavior is infinity if a trap is
not raised.

    $ cat test.c
    #include <float.h>
    #include <math.h>
    int main(void)
    {
      return INFINITY == 1.0f / 0.0f ? 0 : 1;
    }

    $ clang -fsanitize=undefined test.c -o test.exe
    $ ./test.exe 
    test.c:5:27: runtime error: division by zero

GCC does not produce a finding for floats.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to