[llvm-bugs] [Bug 19535] UBSan: Floating point division by zero is not undefined

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jul 9 19:06:40 PDT 2019


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

Fangrui Song <i at maskray.me> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|---                         |FIXED
                 CC|                            |i at maskray.me

--- Comment #13 from Fangrui Song <i at maskray.me> ---
float-divide-by-zero was removed from the -fsanitize=undefined by
https://reviews.llvm.org/D63793

% cat a.c
int main() { float x = 1.f; float y = x/0.f; y = x/0.f; }
% clang -fsanitize=undefined a.c -o a && ./a
% clang++ -xc++ -fsanitize=undefined a.c -o a && ./a
% gcc -fsanitize=undefined a.c -o a && ./a
% gcc -xc++ -fsanitize=undefined a.c -o a && ./a
# no complaint

The fallout should be fixed by D64317.

% clang -fsanitize=float-divide-by-zero a.c -o a && ./a
a.c:1:40: runtime error: division by zero
a.c:1:51: runtime error: division by zero
% gcc -fsanitize=float-divide-by-zero a.c -o a && ./a
a.c:1:40: runtime error: division by zero
a.c:1:51: runtime error: division by zero

The changes shall be included by clang 9.

-- 
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/20190710/fb56a194/attachment-0001.html>


More information about the llvm-bugs mailing list