Patchwork [c++] : Fix PR 53441, [4.8 Regression] obj-c++.dg/ivar-invalid-type-1.mm ICE

login
register
mail settings
Submitter Uros Bizjak
Date May 21, 2012, 9:41 p.m.
Message ID <CAFULd4aEJ7pTrv22zmFD5aZuryOmru4QmWWCUr6o8boq4VTkiQ@mail.gmail.com>
Download mbox | patch
Permalink /patch/160486/
State New
Headers show

Comments

Uros Bizjak - May 21, 2012, 9:41 p.m.
Hello!

As shown in the PR, ivar-invalid-type-1 ICEs in constructor_name_p,
due to accessor on NULL "type" argument.

The one-liner patch fixes the ICE by adding a guard that checks that
current_class_type is non-NULL before calling constructor_name_p.

2012-05-21  Uros Bizjak  <ubizjak@gmail.com>

	PR obj-c++/53441
	* decl.c (grokdeclarator): Check that current_class_type is non-NULL
	before calling constructor_name_p.

Patch was bootstrapped and regression tested on x86_64-pc-linux-gnu {,-m32}.

OK for mainline SVN?

Uros.
Dodji Seketeli - May 25, 2012, 4:06 p.m.
Uros Bizjak <ubizjak@gmail.com> a écrit:

> As shown in the PR, ivar-invalid-type-1 ICEs in constructor_name_p,
> due to accessor on NULL "type" argument.
>
> The one-liner patch fixes the ICE by adding a guard that checks that
> current_class_type is non-NULL before calling constructor_name_p.
>
> 2012-05-21  Uros Bizjak  <ubizjak@gmail.com>
>
> 	PR obj-c++/53441
> 	* decl.c (grokdeclarator): Check that current_class_type is non-NULL
> 	before calling constructor_name_p.
>
> Patch was bootstrapped and regression tested on x86_64-pc-linux-gnu {,-m32}.
>
> OK for mainline SVN?

I cannot approve or deny this patch, but it looks OK to me.  Let's CC
Jason.

[...]

> Index: decl.c
> ===================================================================
> --- decl.c	(revision 187736)
> +++ decl.c	(working copy)
> @@ -9803,7 +9803,8 @@ grokdeclarator (const cp_declarator *declarator,
>  	       clones.  */
>  	    DECL_ABSTRACT (decl) = 1;
>  	}
> -      else if (constructor_name_p (unqualified_id, current_class_type))
> +      else if (current_class_type
> +	       && constructor_name_p (unqualified_id, current_class_type))
>  	permerror (input_location, "ISO C++ forbids nested type %qD with same name "
>  		   "as enclosing class",
>  		   unqualified_id);
Jason Merrill - May 25, 2012, 4:19 p.m.
OK.

Jason

Patch

Index: decl.c
===================================================================
--- decl.c	(revision 187736)
+++ decl.c	(working copy)
@@ -9803,7 +9803,8 @@  grokdeclarator (const cp_declarator *declarator,
 	       clones.  */
 	    DECL_ABSTRACT (decl) = 1;
 	}
-      else if (constructor_name_p (unqualified_id, current_class_type))
+      else if (current_class_type
+	       && constructor_name_p (unqualified_id, current_class_type))
 	permerror (input_location, "ISO C++ forbids nested type %qD with same name "
 		   "as enclosing class",
 		   unqualified_id);