This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/52655] right shit in switch: gcc compiles with error: label at end of compound statement
- From: "mikpe at it dot uu.se" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 21 Mar 2012 11:29:40 +0000
- Subject: [Bug c/52655] right shit in switch: gcc compiles with error: label at end of compound statement
- Auto-submitted: auto-generated
- References: <bug-52655-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52655
--- Comment #1 from Mikael Pettersson <mikpe at it dot uu.se> 2012-03-21 11:29:40 UTC ---
(In reply to comment #0)
> The following code compiles with error: label at end of compound statement with
> the gcc 4.6.1 compiler.
>
> Content of t.c:
> ----8<----
> void
> foo (int op)
> {
> int x = 100000 >> 3; /* OK */
>
> switch (op)
> {
> case 0:
> x = 100000 >> 3; /* t.c:12:5: error: label at end of compound
> statement */
> break;
>
> default:
The "default:" acts as a label, and it needs a statement after it. Just add
";" after it, or delete it. The shift has nothing to do with this issue.