Commit 8569048 introduces bug with local extern

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Commit 8569048 introduces bug with local extern

Giovanni Mascellani
Hi,

commit 85690480313c4a8b0efeb3761ee68456cfe57840 introduces a bug when
trying to compile the following file:

int main() {
        extern char *x;
}
void main1() {
        extern char *x;
}

Fails with:
t2.c:5: error: incompatible types for redefinition of 'x'

Doing some random tests, it seems that the error appears when x is
defined as a pointer, but not when x is defined as a standard numeric
type (int, char, ...). Also, the error does not appear when function
main1() is deleted. I believe that when compiling a local extern
variable some global state is changed and it is not reset at the end of
the function.

I'm not able to understand anything better from the code.

Thanks, Giovanni.
--
Giovanni Mascellani <[hidden email]>
Postdoc researcher - Université Libre de Bruxelles


_______________________________________________
Tinycc-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

signature.asc (235 bytes) Download Attachment