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

            Bug ID: 22223
           Summary: inconsistent -Wsign-compare warnings due to type cast
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

If I add the type cast (int)(0 > a), Clang warns. Otherwise not. 

$: cat s.c
int a;
void fn1(int b) { 
  0xEE5FD967FC84F78BLL <= ((int)(0 > a) / (long long)1); //<-warning here
  0xEE5FD967FC84F78BLL <= (     (0 > a) / (long long)1); //<-NO warning
}
$: 
$: clang-trunk -c s.c -Wsign-compare -Wno-unused-value
s.c:3:24: warning: comparison of integers of different signs: 'unsigned long
long' and 'long long'
      [-Wsign-compare]
  0xEE5FD967FC84F78BLL <= ((int)(0 > a) / (long long)1); //<-warning here
  ~~~~~~~~~~~~~~~~~~~~ ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
$: 
$: gcc-trunk -c s.c -Wsign-compare 
$: 
$:

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