public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/29062] New: Parse error after label and variable declaration
@ 2006-09-13 15:19 tdalman at project-psi dot org
2006-09-13 15:32 ` [Bug c/29062] " schwab at suse dot de
` (10 more replies)
0 siblings, 11 replies; 12+ messages in thread
From: tdalman at project-psi dot org @ 2006-09-13 15:19 UTC (permalink / raw)
To: gcc-bugs
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
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c/29062] Parse error after label and variable declaration
2006-09-13 15:19 [Bug c/29062] New: Parse error after label and variable declaration tdalman at project-psi dot org
@ 2006-09-13 15:32 ` schwab at suse dot de
2006-09-13 22:27 ` neil at daikokuya dot co dot uk
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: schwab at suse dot de @ 2006-09-13 15:32 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from schwab at suse dot de 2006-09-13 15:32 -------
A label can only be part of a statement. A declaration is not a statement.
--
schwab at suse dot de changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
Summary|Parse error after label and |Parse error after label and
|variable declaration |variable declaration
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29062
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c/29062] Parse error after label and variable declaration
2006-09-13 15:19 [Bug c/29062] New: Parse error after label and variable declaration tdalman at project-psi dot org
2006-09-13 15:32 ` [Bug c/29062] " schwab at suse dot de
@ 2006-09-13 22:27 ` neil at daikokuya dot co dot uk
2006-09-14 6:40 ` tdalman at project-psi dot org
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: neil at daikokuya dot co dot uk @ 2006-09-13 22:27 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from neil at daikokuya dot co dot uk 2006-09-13 22:27 -------
Subject: Re: Parse error after label and variable declaration
schwab at suse dot de wrote:-
>
>
> ------- Comment #1 from schwab at suse dot de 2006-09-13 15:32 -------
> A label can only be part of a statement. A declaration is not a statement.
>
Considering the number of times this is reported, and people clearly
don't understand what is wrong with their code, it should be
considered a case of very poor diagnostics.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29062
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c/29062] Parse error after label and variable declaration
2006-09-13 15:19 [Bug c/29062] New: Parse error after label and variable declaration tdalman at project-psi dot org
2006-09-13 15:32 ` [Bug c/29062] " schwab at suse dot de
2006-09-13 22:27 ` neil at daikokuya dot co dot uk
@ 2006-09-14 6:40 ` tdalman at project-psi dot org
2006-10-12 20:47 ` pinskia at gcc dot gnu dot org
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: tdalman at project-psi dot org @ 2006-09-14 6:40 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from tdalman at project-psi dot org 2006-09-14 06:40 -------
Thanks for clarification. Nevertheless, your wording, Andreas, is exactly what
I would have expected in the error message.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29062
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c/29062] Parse error after label and variable declaration
2006-09-13 15:19 [Bug c/29062] New: Parse error after label and variable declaration tdalman at project-psi dot org
` (2 preceding siblings ...)
2006-09-14 6:40 ` tdalman at project-psi dot org
@ 2006-10-12 20:47 ` pinskia at gcc dot gnu dot org
2006-10-13 12:52 ` [Bug c/29062] unclear diagnostic for declaration after label falk at debian dot org
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-10-12 20:47 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from pinskia at gcc dot gnu dot org 2006-10-12 20:47 -------
*** Bug 29444 has been marked as a duplicate of this bug. ***
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |alx at gotnull dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29062
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c/29062] unclear diagnostic for declaration after label
2006-09-13 15:19 [Bug c/29062] New: Parse error after label and variable declaration tdalman at project-psi dot org
` (3 preceding siblings ...)
2006-10-12 20:47 ` pinskia at gcc dot gnu dot org
@ 2006-10-13 12:52 ` falk at debian dot org
2007-03-13 16:06 ` manu at gcc dot gnu dot org
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: falk at debian dot org @ 2006-10-13 12:52 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from falk at debian dot org 2006-10-13 12:52 -------
I also think the diagnostics should be improved.
--
falk at debian dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|minor |enhancement
Status|RESOLVED |UNCONFIRMED
GCC host triplet|i486-linux |
Keywords| |diagnostic
Known to fail| |4.1.2 4.2.0
Resolution|INVALID |
Summary|Parse error after label and |unclear diagnostic for
|variable declaration |declaration after label
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29062
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c/29062] unclear diagnostic for declaration after label
2006-09-13 15:19 [Bug c/29062] New: Parse error after label and variable declaration tdalman at project-psi dot org
` (4 preceding siblings ...)
2006-10-13 12:52 ` [Bug c/29062] unclear diagnostic for declaration after label falk at debian dot org
@ 2007-03-13 16:06 ` manu at gcc dot gnu dot org
2007-11-03 14:18 ` manu at gcc dot gnu dot org
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: manu at gcc dot gnu dot org @ 2007-03-13 16:06 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from manu at gcc dot gnu dot org 2007-03-13 16:05 -------
I think this is confirmed, we can try to do better.
--
manu at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2007-03-13 16:05:53
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29062
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c/29062] unclear diagnostic for declaration after label
2006-09-13 15:19 [Bug c/29062] New: Parse error after label and variable declaration tdalman at project-psi dot org
` (5 preceding siblings ...)
2007-03-13 16:06 ` manu at gcc dot gnu dot org
@ 2007-11-03 14:18 ` manu at gcc dot gnu dot org
2007-11-03 19:41 ` manu at gcc dot gnu dot org
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: manu at gcc dot gnu dot org @ 2007-11-03 14:18 UTC (permalink / raw)
To: gcc-bugs
--
manu at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |manu at gcc dot gnu dot org
|dot org |
Status|NEW |ASSIGNED
Last reconfirmed|2007-03-13 16:05:53 |2007-11-03 14:18:03
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29062
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c/29062] unclear diagnostic for declaration after label
2006-09-13 15:19 [Bug c/29062] New: Parse error after label and variable declaration tdalman at project-psi dot org
` (6 preceding siblings ...)
2007-11-03 14:18 ` manu at gcc dot gnu dot org
@ 2007-11-03 19:41 ` manu at gcc dot gnu dot org
2007-11-03 19:44 ` manu at gcc dot gnu dot org
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: manu at gcc dot gnu dot org @ 2007-11-03 19:41 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from manu at gcc dot gnu dot org 2007-11-03 19:41 -------
Subject: Bug 29062
Author: manu
Date: Sat Nov 3 19:41:20 2007
New Revision: 129873
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=129873
Log:
2007-11-03 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
PR c/29062
* c-parser.c (c_parser_statement_after_labels): Error if a
declaration is parsed after a label.
testsuite/
* gcc.dg/20031223-1.c: Adjust error output.
* gcc.dg/parse-decl-after-label.c: New.
Added:
trunk/gcc/testsuite/gcc.dg/parse-decl-after-label.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/c-parser.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gcc.dg/20031223-1.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29062
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c/29062] unclear diagnostic for declaration after label
2006-09-13 15:19 [Bug c/29062] New: Parse error after label and variable declaration tdalman at project-psi dot org
` (7 preceding siblings ...)
2007-11-03 19:41 ` manu at gcc dot gnu dot org
@ 2007-11-03 19:44 ` manu at gcc dot gnu dot org
2007-11-10 3:48 ` patchapp at dberlin dot org
2007-11-10 17:25 ` patchapp at dberlin dot org
10 siblings, 0 replies; 12+ messages in thread
From: manu at gcc dot gnu dot org @ 2007-11-03 19:44 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from manu at gcc dot gnu dot org 2007-11-03 19:43 -------
Fixed for GCC 4.3
--
manu at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.3.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29062
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c/29062] unclear diagnostic for declaration after label
2006-09-13 15:19 [Bug c/29062] New: Parse error after label and variable declaration tdalman at project-psi dot org
` (8 preceding siblings ...)
2007-11-03 19:44 ` manu at gcc dot gnu dot org
@ 2007-11-10 3:48 ` patchapp at dberlin dot org
2007-11-10 17:25 ` patchapp at dberlin dot org
10 siblings, 0 replies; 12+ messages in thread
From: patchapp at dberlin dot org @ 2007-11-10 3:48 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from patchapp at dberlin dot org 2007-11-10 03:47 -------
Subject: Bug number PR c/29062
A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is
http://gcc.gnu.org/ml/gcc-patches/2007-11/msg00111.html
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29062
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c/29062] unclear diagnostic for declaration after label
2006-09-13 15:19 [Bug c/29062] New: Parse error after label and variable declaration tdalman at project-psi dot org
` (9 preceding siblings ...)
2007-11-10 3:48 ` patchapp at dberlin dot org
@ 2007-11-10 17:25 ` patchapp at dberlin dot org
10 siblings, 0 replies; 12+ messages in thread
From: patchapp at dberlin dot org @ 2007-11-10 17:25 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from patchapp at dberlin dot org 2007-11-10 17:25 -------
Subject: Bug number PR c/29062
A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is
http://gcc.gnu.org/ml/gcc-patches/2007-11/msg00111.html
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29062
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2007-11-10 17:25 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-13 15:19 [Bug c/29062] New: Parse error after label and variable declaration tdalman at project-psi dot org
2006-09-13 15:32 ` [Bug c/29062] " schwab at suse dot de
2006-09-13 22:27 ` neil at daikokuya dot co dot uk
2006-09-14 6:40 ` tdalman at project-psi dot org
2006-10-12 20:47 ` pinskia at gcc dot gnu dot org
2006-10-13 12:52 ` [Bug c/29062] unclear diagnostic for declaration after label falk at debian dot org
2007-03-13 16:06 ` manu at gcc dot gnu dot org
2007-11-03 14:18 ` manu at gcc dot gnu dot org
2007-11-03 19:41 ` manu at gcc dot gnu dot org
2007-11-03 19:44 ` manu at gcc dot gnu dot org
2007-11-10 3:48 ` patchapp at dberlin dot org
2007-11-10 17:25 ` patchapp at dberlin dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).