CodeGen/statements.c: Don't understand test and its failure

On Windows, the CodeGen/statements.c test fails, apparently because of this error:

3>:23:17: error: initializer element is not a compile-time constant
3>static long x = &&bar - &&baz;
3> ^~~~~~~~~~~~~

First, what does a unary “&&” do on a variable? Address of an address? It doesn’t seem to make sense.

Second, why would it result in an error in VC+±built Clang, but not on other platforms? (I tried using other target triples, but there was no change.)

I know I’ll probably have to debug it, but understanding the first might help.

This is the GNU address of a label extension. Can you remove the 'static' (which will allow it to parse) and paste what clang-cc -ast-dump shows for that statement?

-Chris

Sorry Chris, I meant to send this to the list.

Sorry Chris, I meant to send this to the list.

The relevant part of the dump is:

(DeclStmt 029B7238 <line:23:1, col:23>
029B70A8 “long x =
(ImplicitCastExpr 029B71F0 <col:10, col:20> ‘long’
(BinaryOperator 029B71A0 <col:10, col:20> ‘int’ ‘-’
(AddrLabelExpr 029B7110 <col:10, col:12> ‘void *’ bar 029B7068)
(AddrLabelExpr 029B7158 <col:18, col:20> ‘void *’ baz 029B7028)))”

This case should have been fixed by r84039. Can you verify that it still fails with ToT?

-Chris

Chris,

statements.c passes now. Thanks!

-John