Commit 417fa55b by Lee Millward Committed by Lee Millward

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
parent bfabddb6
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
......
......@@ -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;
......
......@@ -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));
}
......
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
//PR c++/27820
void foo()
{
L: L: ; // { dg-error "duplicate label" }
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment