aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Carlini <pcarlini@suse.de>2007-07-30 09:37:20 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2007-07-30 09:37:20 +0000
commita6d76a9544b6873d32db7ee8445472a2deda033a (patch)
tree0e8a252c5c0d0359f7fe24e52ca3bc43a3ef72bb
parent5c24ddaf36be1236f276269d356257d59ff860b3 (diff)
downloadgcc-a6d76a9544b6873d32db7ee8445472a2deda033a.zip
gcc-a6d76a9544b6873d32db7ee8445472a2deda033a.tar.gz
gcc-a6d76a9544b6873d32db7ee8445472a2deda033a.tar.bz2
re PR c++/32108 (ICE with __label__ outside of block scope)
cp/ 2007-07-30 Paolo Carlini <pcarlini@suse.de> PR c++/32108 * semantics.c (finish_label_stmt): Reject the __label__ extension outside function scopes. testsuite/ 2007-07-30 Paolo Carlini <pcarlini@suse.de> PR c++/32108 * g++.dg/ext/label6.C: New. From-SVN: r127059
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/semantics.c9
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/ext/label6.C3
4 files changed, 21 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 24006fe..8004e19 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2007-07-30 Paolo Carlini <pcarlini@suse.de>
+
+ PR c++/32108
+ * semantics.c (finish_label_stmt): Reject the __label__
+ extension outside function scopes.
+
2007-07-29 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* parser.c (eof_token): Un-constify.
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index b03ec2f..d80cd2b 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -1343,8 +1343,13 @@ finish_label_stmt (tree name)
void
finish_label_decl (tree name)
{
- tree decl = declare_local_label (name);
- add_decl_expr (decl);
+ if (!at_function_scope_p ())
+ {
+ error ("__label__ declarations are only allowed in function scopes");
+ return;
+ }
+
+ add_decl_expr (declare_local_label (name));
}
/* When DECL goes out of scope, make sure that CLEANUP is executed. */
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 7d4be5e..f60df69 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2007-07-30 Paolo Carlini <pcarlini@suse.de>
+
+ PR c++/32108
+ * g++.dg/ext/label6.C: New.
+
2007-07-29 Thomas Koenig <tkoenig@gcc.gnu.org>
PR libfortran/32858
diff --git a/gcc/testsuite/g++.dg/ext/label6.C b/gcc/testsuite/g++.dg/ext/label6.C
new file mode 100644
index 0000000..d026777
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/label6.C
@@ -0,0 +1,3 @@
+// PR c++/32108
+
+__label__ L; // { dg-error "function scopes" }