[cfe-dev] clang vs. gcc
Douglas Gregor
dgregor at apple.com
Wed Apr 29 07:39:02 PDT 2009
On Apr 29, 2009, at 4:12 AM, Filipe Cabecinhas wrote:
> 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?
Both! ;)
> 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.
This isn't valid C89 or C99, but it's a GNU extension and it seems
reasonable. Please file a bug report and we'll add it as a GNU
extension.
- Doug
More information about the cfe-dev
mailing list