diff options
author | Lee Millward <lee.millward@gmail.com> | 2006-07-07 17:57:12 +0000 |
---|---|---|
committer | Lee Millward <lmillward@gcc.gnu.org> | 2006-07-07 17:57:12 +0000 |
commit | 417fa55ba52871b56fbe023816a1770dafceda60 (patch) | |
tree | 7188c6ff46aae01dbc101916159cda34535ef8f2 /gcc | |
parent | bfabddb6c0307307e963bf1388fcad0b8a00ba5c (diff) | |
download | gcc-417fa55ba52871b56fbe023816a1770dafceda60.zip gcc-417fa55ba52871b56fbe023816a1770dafceda60.tar.gz gcc-417fa55ba52871b56fbe023816a1770dafceda60.tar.bz2 |
re PR c++/27820 (ICE with duplicate label)
PR c++/27820
* decl.c (define_label): Return error_mark_node on error.
* semantics.c (finish_label_stmt): Don't call
add_stmt for invalid labels.
* g++.dg/other/label1.C: New test.
Co-Authored-By: Andrew Pinski <pinskia@gmail.com>
From-SVN: r115265
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/cp/decl.c | 5 | ||||
-rw-r--r-- | gcc/cp/semantics.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/other/label1.C | 7 |
5 files changed, 28 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b792964..d499bfd 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,11 @@ +2006-06-29 Lee Millward <lee.millward@gmail.com> + Andrew Pinski <pinskia@gmail.com> + + PR c++/27820 + * decl.c (define_label): Return error_mark_node on error. + * semantics.c (finish_label_stmt): Don't call + add_stmt for invalid labels. + 2006-07-06 Jason Merrill <jason@redhat.com> PR c++/28279 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 49d1920..1d5be58 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -2543,7 +2543,10 @@ define_label (location_t location, tree name) pedwarn ("label named wchar_t"); if (DECL_INITIAL (decl) != NULL_TREE) - error ("duplicate label %qD", decl); + { + error ("duplicate label %qD", decl); + POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node); + } else { struct named_label_use_entry *use; diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index c5b3fbb..9ecace6 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -1293,6 +1293,10 @@ tree finish_label_stmt (tree name) { tree decl = define_label (input_location, name); + + if (decl == error_mark_node) + return error_mark_node; + return add_stmt (build_stmt (LABEL_EXPR, decl)); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6ce58b2..9203c15 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2006-07-07 Lee Millward <lee.millward@gmail.com> + + PR c++/27820 + * g++.dg/other/label1.C: New test. + 2006-07-07 Richard Guenther <rguenther@suse.de> PR middle-end/28268 diff --git a/gcc/testsuite/g++.dg/other/label1.C b/gcc/testsuite/g++.dg/other/label1.C new file mode 100644 index 0000000..74572dc --- /dev/null +++ b/gcc/testsuite/g++.dg/other/label1.C @@ -0,0 +1,7 @@ +//PR c++/27820 + +void foo() +{ + L: L: ; // { dg-error "duplicate label" } +} + |