[llvm-bugs] [Bug 28994] New: Clang spams a -Wunreachable-code warning for some Firefox code that it didn't warn about in 3.8

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Aug 15 19:31:17 PDT 2016


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

            Bug ID: 28994
           Summary: Clang spams a -Wunreachable-code warning for some
                    Firefox code that it didn't warn about in 3.8
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: dholbert at mozilla.com
                CC: cpeterson at mozilla.com, dblaikie at gmail.com,
                    llvm-bugs at lists.llvm.org
    Classification: Unclassified

I'm spinning this off to cover the behavior-difference between clang 3.8 vs 3.9
discussed in bug 28918.

In the Firefox build process, we have some autogenerated C++ code[1] that looks
like this:
>  JS::Rooted<JS::Value> rval(cx, JS::UndefinedValue());
> [SNIP]
>    if ((false) && !CallerSubsumes(rval)) {
>       ThrowErrorMessage(...etc...)

In clang 3.8, this code compiles just fine.
In clang 3.9, this code triggers an unreachable code warning for the
ThrowErrorMessage call in clang 3.9.  It should not, because the "false" in the
if-condition is wrapped in parens, which is supposed to be a hint that
Wunreachable-code warnings should be suppressed.

My first attempt at minimizing a C++ testcase from this code produced something
that caused the same issue in older clang revisions (and bug 28918 is filed on
that long-standing bug)  So, I'm still not exactly sure what exact conditions
are involved in the 3.8-3.9 behavior-change here.

HOWEVER, I did try bisecting the clang source to find the first SVN revision
that exhibits the problem.  That first revision is r273312:
 http://llvm.org/viewvc/llvm-project?view=revision&revision=273312

If I check out & build the previous revision of clang (273311), I do not
encounter this error when building Firefox.  But with 273312, I do encounter
this error.

[1] The autogenerated C++ code in question here is
$OBJ/dom/bindings/TestCodeGenBinding.cpp ($OBJ is the object directory, i.e.
where files generated by our build process end up)

-- 
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/20160816/2b5cc511/attachment-0001.html>


More information about the llvm-bugs mailing list