[LLVMbugs] [Bug 9920] New: Another case of unnecessary "shift count is negative" warning

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun May 15 06:10:09 PDT 2011


http://llvm.org/bugs/show_bug.cgi?id=9920

           Summary: Another case of unnecessary "shift count is negative"
                    warning
           Product: new-bugs
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: dimitry at andric.com
                CC: llvmbugs at cs.uiuc.edu


Created an attachment (id=6598)
 --> (http://llvm.org/bugs/attachment.cgi?id=6598)
Trigger unneeded "shift count is negative" warning

[Creating this as a separate PR.]

This warning still appears while compiling the FreeBSD kernel source tree, even
with ToT, as reported to me by Matthew Fleming.  I just tested a further
reduced version of his sample with trunk r131368, and it gives:

pr5544c.c:4:17: warning: shift count is negative
unsigned data = W1(1);
                ^~~~~
pr5544c.c:2:47: note: instantiated from:
    (((_a) > 31 && (_a) < 64 ? (((unsigned) 1)<<((_a)-32)) : (unsigned) 0))
                                              ^ ~~~~~~~~~
1 warning generated.

Ted Kremenek said about this in bug 5544:

> The underlying problem is not that we don't prune these warnings on paths that
> can be shown to be dead.  The problem here is that Clang doesn't know this
> branch is dead.  The issue is how the CFG models || and && operations.  That's
> worth tracking in a separate bug.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list