public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/39028]  New: C++ front-end rejects "__label__" at the beginning of a block after "for" and "while"
@ 2009-01-29 20:08 springl-gcc at bfw-online dot de
  2009-01-29 20:11 ` [Bug c++/39028] [4.3/4.4 Regression] " pinskia at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 10+ messages in thread
From: springl-gcc at bfw-online dot de @ 2009-01-29 20:08 UTC (permalink / raw)
  To: gcc-bugs

Trying to compile the c++ program label.C

void c ()
{ for (;;)   {__label__ l; goto l; l:;}
  while (1)  {__label__ l; goto l; l:;}
  if (1)     {__label__ l; goto l; l:;}
  do         {__label__ l; goto l; l:;} while (1);
             {__label__ l; goto l; l:;}
}

using
  g++ -Wall -Wextra   -c label.C
with g++ versions 4.4.0 20090129 (experimental) and 4.3.3 gives:

label.C: In function 'void c()':
label.C:2: error: '__label__' not at the beginning of a block
label.C:3: error: '__label__' not at the beginning of a block
label.C:3: error: duplicate label 'l'

The fix for bug 32121 "C++ front-end accepts invalid __label__
declarations" (svn revision 129253) moved handling __label__ declarations
to function cp_parser_compound_statement in gcc/cp/parser.c and omitted
it in function cp_parser_already_scoped_statement.  The newly introduced
tests cases only check the error case for while and for statements,
unfortunately.

Without any deeper understanding of gcc internals, I suggest two
possible fixes:

- copy the two lines handling __label__ declarations
from function cp_parser_compound_statement to function
cp_parser_already_scoped_statement, which might be the smallest change or
- merge part of cp_parser_already_scoped_statement's functionality to
cp_parser_compound_statement avoiding code duplication.


-- 
           Summary: C++ front-end rejects "__label__" at the beginning of a
                    block after "for" and "while"
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: springl-gcc at bfw-online dot de
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39028


^ permalink raw reply	[flat|nested] 10+ messages in thread
[parent not found: <bug-39028-4@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2011-06-27 12:06 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-29 20:08 [Bug c++/39028] New: C++ front-end rejects "__label__" at the beginning of a block after "for" and "while" springl-gcc at bfw-online dot de
2009-01-29 20:11 ` [Bug c++/39028] [4.3/4.4 Regression] " pinskia at gcc dot gnu dot org
2009-01-30 12:00 ` jakub at gcc dot gnu dot org
2009-01-30 16:18 ` jakub at gcc dot gnu dot org
2009-01-30 16:18 ` [Bug c++/39028] [4.3 " jakub at gcc dot gnu dot org
2009-02-21 13:16 ` rguenth at gcc dot gnu dot org
2009-03-13 22:57 ` rguenth at gcc dot gnu dot org
2009-08-04 12:47 ` rguenth at gcc dot gnu dot org
2010-05-22 18:29 ` rguenth at gcc dot gnu dot org
     [not found] <bug-39028-4@http.gcc.gnu.org/bugzilla/>
2011-06-27 12:06 ` rguenth at gcc dot gnu.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).