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: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]


$ 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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to