[llvm-bugs] [Bug 30631] New: Clang shows multiple unreachable code warnings when one warning is sufficient

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Oct 7 02:15:07 PDT 2016


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

            Bug ID: 30631
           Summary: Clang shows multiple unreachable code warnings when
                    one warning is sufficient
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: arphaman at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Typically, when clang is given the '-Wunreachable-code' option, it would show a
minimal number of warnings when it encounters unreachable statements.

However, clang shows multiple warnings for unreachable code that's mixed
together with statements like 'return'. For example, clang will show two
unreachable warnings when the code below is compiled with '-Wunreachable-code':

int foo() {
  return 0; 
}
int bar(int x) {
  if (x == 0)
    return x + 1;
  else
    return x;
  foo(); // warning will be shown here
  return 0;
  foo(); // and another warning will be shown here
}

-- 
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/20161007/e9f088cc/attachment.html>


More information about the llvm-bugs mailing list