[llvm-bugs] [Bug 25390] New: _Generic -Wdivision-by-zero bogus warning

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Nov 3 08:28:36 PST 2015


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

            Bug ID: 25390
           Summary: _Generic -Wdivision-by-zero bogus warning
           Product: clang
           Version: 3.5
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: eggert at cs.ucla.edu
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 15208
  --> https://llvm.org/bugs/attachment.cgi?id=15208&action=edit
program illustrating bogus warning

With the attached program, clang complains

u.c:5:47: warning: division by zero is undefined [-Wdivision-by-zero]
  int j = _Generic (i, int: 0, default: 0 ? 1 / 0 : 1);
                                              ^ ~

The warning is bogus because the expression is not evaluated, for two reasons:
first, it's inside a _Generic alternative not taken; second, it's inside an
if-branch that's not taken.

-- 
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/20151103/df11413a/attachment.html>


More information about the llvm-bugs mailing list