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]

[C++ PATCH]: fix 20678


Hi,
this patch fixes 20678, an ICE on error.

booted & tested on i686-pc-linux-gnu. installed mainline, waiting for 4.0 unfreeze.

nathan
--
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk

2005-06-15  Nathan Sidwell  <nathan@codesourcery.com>

	PR c++/20678
	* error.c (dump_expr) <COMPONENT_REF case>: Check DECL_NAME is not
	null.

2005-06-15  Nathan Sidwell  <nathan@codesourcery.com>

	PR c++/20678
	* g++.dg/other/crash-4.C: New.

Index: cp/error.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/error.c,v
retrieving revision 1.285
diff -c -3 -p -r1.285 error.c
*** cp/error.c	15 Jun 2005 00:41:22 -0000	1.285
--- cp/error.c	15 Jun 2005 08:19:12 -0000
*************** dump_expr (tree t, int flags)
*** 1489,1495 ****
  	  {
  	    ob = TREE_OPERAND (ob, 0);
  	    if (TREE_CODE (ob) != PARM_DECL
! 		|| strcmp (IDENTIFIER_POINTER (DECL_NAME (ob)), "this"))
  	      {
  		dump_expr (ob, flags | TFF_EXPR_IN_PARENS);
  		pp_cxx_arrow (cxx_pp);
--- 1489,1496 ----
  	  {
  	    ob = TREE_OPERAND (ob, 0);
  	    if (TREE_CODE (ob) != PARM_DECL
! 		|| (DECL_NAME (ob)
! 		    && strcmp (IDENTIFIER_POINTER (DECL_NAME (ob)), "this")))
  	      {
  		dump_expr (ob, flags | TFF_EXPR_IN_PARENS);
  		pp_cxx_arrow (cxx_pp);
Index: testsuite/g++.dg/other/crash-4.C
===================================================================
RCS file: testsuite/g++.dg/other/crash-4.C
diff -N testsuite/g++.dg/other/crash-4.C
0a1,19
> // Copyright (C) 2005 Free Software Foundation, Inc.
> // Contributed by Nathan Sidwell 14 Jun 2005 <nathan@codesourcery.com>
> 
> // PR 20678: ICE on error message
> // Origin:  Andrew Pinski pinskia@gcc.gnu.org
> 
> struct a
> {
>   a(const a&);
> };
> struct b
> { // { dg-error "cannot bind packed field" }
>   a aa __attribute__((packed));
> };
> struct c
> {
>   b bb;
>   c(const b& __a): bb(__a) {} // { dg-error "synthesized" }
> };

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