[LLVMbugs] [Bug 18504] New: No warning for comparison of integers of different signs

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jan 15 23:05:18 PST 2014


            Bug ID: 18504
           Summary: No warning for comparison of integers of different
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: chengniansun at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Clang does not emit a warning for the comparison of integers of different

I have the following program: 

////////////////// s.c: program start///////////
int unreported(unsigned a, int *b) {
        return a > (~(95 != *b));
////////////////// program end///////////

And compile it with the following command, but Clang emits no warning for the
expression "a > (~(95 != *b))"
$clang -Wall -Wextra -std=c11 -pedantic -c s.c
$clang --version
clang version 3.5 (trunk 198918)
Target: x86_64-unknown-linux-gnu
Thread model: posix

Differently, GCC emits a warning with the following command
gcc -Wall -Wextra -std=c11 -pedantic -c s.c

s.c: In function ‘unreported’:
s.c:7:11: warning: comparison between signed and unsigned integer expressions
  return a > (~(95 != *b));

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140116/c8933946/attachment.html>

More information about the llvm-bugs mailing list