This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] Fix PR c++/27820


Hi,

The C++ front-end currently ICE's on the following invalid code snippet:

void foo()
{
   L: L: ;
}

In the bugzilla PR Andrew Pinski suggested the first portion of the
patch to define_label return error_mark_node when an invalid label is
detected. Unfortunately this simply swaps the ICE listed in the PR for
an ICE in the gimplifier. This is because finish_label_stmt doesn't
check to make sure that the label being returned to it from
define_label is valid or not before calling add_stmt.

The proposed patch below incorporates Andrew Pinski's initial
suggestion with a further ammendment to finish_label_stmt to check for
invalid labels before calling add_stmt.

Bootstrapped and regression tested successfully on i686-pc-linux-gnu,
ok for mainline and for 4.1/4.0 assuming bootstrap/reg test succeeds
there?

Cheers,
Lee.

cp/

2006-06-30  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.

testsuite/

2006-06-30 Lee Millward <lee.millward@gmail.com>

	PR c++/27820
	* g++.dg/other/label1.C: New test.

Attachment: pr27820.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]