[cfe-dev] clang vs. gcc

Filipe Cabecinhas filcab at gmail.com
Wed Apr 29 04:12:52 PDT 2009


Hi,

clang doesn't compile the following code:
---------------------------
[filcab at farnsworth ~] $ cat a.c
#include <stdio.h>

extern void a;

int main ()
{
   printf("%p\n", &a);
   return 0;
}
---------------------------

[filcab at farnsworth ~] $ gcc -c a.c
[filcab at farnsworth ~] $ clang -c a.c
a.c:7:18: error: address expression must be an lvalue or a function 
designator
   printf("%p\n", &a);
                  ^~
1 diagnostic generated.

Should I file a bug report or is it intended? If you want to know, it's 
from valgrind's source code. The symbol acts as a marker and is defined 
in a .S file.

Regards,

   Filipe



More information about the cfe-dev mailing list