[Bug c/29062] New: Parse error after label and variable declaration
tdalman at project-psi dot org
gcc-bugzilla@gcc.gnu.org
Wed Sep 13 15:19:00 GMT 2006
Consider following code:
//////////////////////////
1 int main(int argc, char** argv) {
2 if (argc > 1) {
3 goto finish;
4 }
5 finish:
6 int ret = 1;
7 return ret;
8 }
//////////////////////////
Though I tested different versions of GCC (3.3.5, 3.4.4, 4.1.1), I was not able
to compile the code above. This is the error message on a debian sarge with GCC
3.3.5:
//////////////////////////////
tdalman@tarzan:~/src> gcc label.c
label.c: In function `main':
label.c:8: error: syntax error before "int"
label.c:9: error: `ret' undeclared (first use in this function)
label.c:9: error: (Each undeclared identifier is reported only once
label.c:9: error: for each function it appears in.)
//////////////////////////////
I am not sure, whether my code violates the standard, or this is a bug.
However, if I enclose the code after the finish label with curly brackets
(lines 6 and 7), the error disappears.
--
Summary: Parse error after label and variable declaration
Product: gcc
Version: 4.1.1
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: tdalman at project-psi dot org
GCC host triplet: i486-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29062
More information about the Gcc-bugs
mailing list