[cfe-dev] Several missing warnings

Robert Purves listrp at gmail.com
Sat Jul 18 21:55:36 PDT 2009

gcc gives 5 warnings but clang gives none.

$ cat test.c
int main( void )
    unsigned x, y;
    if ( x == -1 ) x = x/0;
    x = x++;
    return 0;
$ clang test.c -O1 -Wsign-compare -Wuninitialized -Wunused -Wsequence- 
$ clang --version
clang version 1.0 (http://llvm.org/svn/llvm-project/cfe/trunk 76360)
Target: i386-apple-darwin9
Thread model: posix
$ gcc test.c -O1 -Wsign-compare -Wuninitialized -Wunused -Wsequence- 
test.c: In function 'main':
test.c:4: warning: comparison between signed and unsigned
test.c:4: warning: division by zero
test.c:5: warning: operation on 'x' may be undefined
test.c:3: warning: unused variable 'y'
test.c:4: warning: 'x' is used uninitialized in this function

Bugzilla filed:

Robert P.

More information about the cfe-dev mailing list