Enrique Naudon from 15-411, Fall 2013, reported the following bug, where gcc on the output of the C0 compiler fails. The issue is that that an implicit declaration of a struct in a parameter list has entirely local scope. If cc0 generated an struct declaration at the beginning of the file (or the companion header file), it would compile correctly without warning or error.
//test error
int bar(struct wrapper *foo);
struct wrapper {
struct s *undef;
};
int main()
{
struct wrapper *blah = alloc(struct wrapper);
return bar(blah);
}
struct s {
int a;
};
int bar(struct wrapper *foo)
{
foo->undef->a = 10;
return foo->undef->a;
}
Should be fixed in revision 525, by redundantly re-declaring all structs that appear in parameter lists before the functions, which gives them global scope.
Enrique Naudon from 15-411, Fall 2013, reported the following bug, where gcc on the output of the C0 compiler fails. The issue is that that an implicit declaration of a struct in a parameter list has entirely local scope. If cc0 generated an struct declaration at the beginning of the file (or the companion header file), it would compile correctly without warning or error.