[llvm-bugs] [Bug 35279] New: Clang does not warn about div-by-zero

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Nov 11 13:55:13 PST 2017


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

            Bug ID: 35279
           Summary: Clang does not warn about div-by-zero
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Static Analyzer
          Assignee: dcoughlin at apple.com
          Reporter: piotr.padlewski at gmail.com
                CC: llvm-bugs at lists.llvm.org

For simple program like this:

#include <stdio.h>
#include <stdint.h>
int main() {
printf("%d\n", (((918515801 / ((1974464271 - (1388439940 / 22917248)) +
(((((1878439744 / ((68069159 - 8735854) - 425199211)) * 1941773574) *
1754447815) / ((((((1893352180 * 244104000) + 955373578) / (995528348 *
181952995)) / (1991957413 * ((1942485480 / 752180376) - 857300598))) /
((1232955370 - 531502124) / (1890372242 + (962926980 * 1635678966)))) *
(596143364 - ((1436747303 * ((595136684 - (1632371992 / 1420536269)) *
386470753)) - 799765743)))) / (1597316699 * (1353498314 / (875331973 +
1518013564)))))) - (1517892652 + 1600483064)) / (322521125 - 1964783090)) *
(1982720318 + ((((2124895355 - 1317543403) + ((1773760518 + 1245421820) *
1036317926)) - (946138651 * 291916216)) / ((2101060860 * 1143439799) -
326679758))));;
printf("%d\n", (407267477 + 1458129826) / 1418630932);;
return 0;}

clang (-Wall -Wextra) does not diagnose any division by zero, where gcc shows
couple of them.

-- 
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/20171111/5679698b/attachment.html>


More information about the llvm-bugs mailing list