[LLVMbugs] [Bug 9402] New: "warning: shift count >= width of type" for unreachable expression

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Mar 4 05:20:12 PST 2011


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

           Summary: "warning: shift count >= width of type" for
                    unreachable expression
           Product: clang
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: dave at jikos.cz
                CC: llvmbugs at cs.uiuc.edu


$ cat test.c
int main() {
        unsigned long long c =  1 ? ~0ULL : (1ULL<<64)-1;
        return c;
}

$ gcc -c test.c
$

$ clang -c test.c
test.c:2:42: warning: shift count >= width of type
        unsigned long long c = 1 ? ~0ULL : (1ULL<<64)-1;
                                                ^ ~~
1 warning generated.
$

When building linux kernel, build log is full of messages like:

include/linux/dma-mapping.h:55:54: note: instantiated from:
#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
                                                     ^ ~~~
drivers/ata/ahci.c:667:42: warning: shift count >= width of type
                rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64));
                                                       ^~~~~~~~~~~~~~~~

all values in DMA_BIT_MASK macro are compile-time constants and the unreachable
case can be eliminated without a warning.

-- 
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