I'm not sure if this behavior is undefined, or if it is a bug in CIL,
but CIL seems to behave different from gcc.
For following function (which might be the result of a macro
substitution), i seems to be 5 for gcc in the inner block, while running
it through CIL would not compile (generating something like i___0 =
i___0;, with i__0 uninitialized)
Is this a bug in CIL, and if so, is there a fix available?
i = 5;
int i = i;
From: Ben Liblit <liblit@cs...> - 2009-11-09 15:41:47
> int i = i;
According to section 6.2.1 paragraph 7 of the C99 specification, a local
variable declaration "has scope that begins just after the completion of
According to section 6.7 paragraph 1 of the same specification, The
declarator includes just the "int i" part of the above code fragment.
The initializer after the equals sign is not part of the declarator:
declarator = initializer
Based on the above, I assert that the inner local variable is already in
scope by the time its initializer is being processed. Hence, you are
initializing the inner local variable with itself, not with the value of
the same-named outer local variable.
Anybody have a contrary reading of the specification?
Get latest updates about Open Source Projects, Conferences and News.