This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/32121] New: [4.1/4.2/4.3 Regression] C++ front-end accepts invalid __label__ declarations
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 28 May 2007 07:27:14 -0000
- Subject: [Bug c++/32121] New: [4.1/4.2/4.3 Regression] C++ front-end accepts invalid __label__ declarations
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
According to our documentation, __label__ declarations have to come first but
the C++ accepts code where they don't which can be shown to be a bit weird with
two labels with the same name.
Here is a testcase which shows that the C++ front-end can accept a case where
we have two labels with the same name:
int f(void)
{
a:;
__label__ a;
int b;
__label__ c;
a:;
c:;
}
This should be rejected, the C front-end rejects this code with the following
errors:
t56.c: In function 'f':
t56.c:4: error: expected expression before '__label__'
t56.c:6: error: expected expression before '__label__'
t56.c:7: error: duplicate label 'a'
t56.c:3: error: previous definition of 'a' was here
This bug was originally found by Chris Lattner.
--
Summary: [4.1/4.2/4.3 Regression] C++ front-end accepts invalid
__label__ declarations
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Keywords: accepts-invalid
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pinskia at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32121