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

            Bug ID: 22253
           Summary: -Wdivision-by-zero does not warn on "1000 / (unsigned
                    char)(a << 8)"
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

I think the current -Wdivision-by-zero can be improved by considering to
support the following case, where "(unsigned char)(a << 8)" is zero. 


$: cat s.c 
int a;
int fn1() { 
  return 1000 / (unsigned char)(a << 8); 
}
$: 
$: gcc-trunk -c s.c -Wdiv-by-zero
s.c: In function ‘fn1’:
s.c:3:15: warning: division by zero [-Wdiv-by-zero]
   return 1000 / (unsigned char)(a << 8); 
               ^
$: 
$: clang-trunk -c s.c -Wdivision-by-zero
$:

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