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: unassignedclangb...@nondot.org
          Reporter: arpha...@gmail.com
                CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to