[llvm-bugs] [Bug 37659] New: alpha.deadcode.UnreachableCode is confused by caller

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Jun 2 02:05:29 PDT 2018


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

            Bug ID: 37659
           Summary: alpha.deadcode.UnreachableCode is confused by caller
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: abramo.bagnara at bugseng.com
                CC: llvm-bugs at lists.llvm.org

If the function where the dead code is placed is called the checker does not
report anything.

Here below we can see that the dead code is reported for function e (not
called), but not reported for identical function f (called by g).

$ cat p.c
int e() {
  if (1) {
    return 1;
  }
  return 2;
}

int f() {
  if (1) {
    return 3;
  }
  return 4;
}

void g() {
  f();
}


$ clang-7 -cc1 -analyze -analyzer-checker=alpha.deadcode.UnreachableCode p.c
p.c:5:10: warning: This statement is never executed
  return 2;
         ^
1 warning generated.

-- 
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/20180602/feb6ca9a/attachment-0001.html>


More information about the llvm-bugs mailing list