On 10/28/2016 05:13 PM, TestRealTime . wrote:
Hello,I would like to report about two (probably, self-connected) bugs in the __typeof__ C function. These bugs are reproduced when I am trying to compile a simple code with XLC compiler on AIX 5.2. Please, look at the code snippets below. 1. typeof_example_1.c long Func(int x) { return x; } int main() { int y, z = 1; y = (__typeof__(Func(z)))0; return 0; } cc_r typeof_example_1.c "typeof_example_1.c", line 5.26: 1506-045 (S) Undeclared identifier z. The 'z' variable is obviously defined, so "Undeclared identifier" message is wrong.
Do you have any evidence that the compiler supports __typeof__ at all? Maybe the compiler treats __typeof__ as an implicitly declared function.
What is interesting, we use cc_r, but not xlc binary in our build system (it is probably due to historical reasons and persons who can answer me why exactly cc_r have gone many years ago). But with xlc both code snippets also fail, however with other error messages (no matter, 32 or 64bit). xlc typeof_example_1.c "typeof_example_1.c", line 5.30: 1506-275 (S) Unexpected text integer constant encountered. xlc typeof_example_2.c "typeof_example_2.c", line 5.41: 1506-275 (S) Unexpected text z encountered. "typeof_example_2.c", line 5.45: 1506-275 (S) Unexpected text integer constant encountered.
Those syntax errors are consistent with not supporting __typeof__ at all. The expression parts which contain __typeof__ are not recognized as types, and so the expression is not recognized as a cast.
Florian
