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: PR 14804


This patch fixes PR 14804, even in unit-at-a-time mode.

The "was_readonly" stuff in cp_finish_decl is probably historical
bogosity, but another problem is that the initializer wasn't being
treated as a valid constant.  There's no need for a dynamic
initialization at all in this case.

Tested on i686-pc-linux-gnu, applied on the mainline and on the
branch.

--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com

2004-04-04  Mark Mitchell  <mark@codesourcery.com>

	PR c++/14804
	* varasm.c (initializer_constant_valid_p): Allow NOP_EXPRs to
	RECORD_TYPEs.

Index: varasm.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/varasm.c,v
retrieving revision 1.405.2.1
diff -c -5 -p -r1.405.2.1 varasm.c
*** varasm.c	30 Jan 2004 14:23:18 -0000	1.405.2.1
--- varasm.c	4 Apr 2004 22:13:12 -0000
*************** initializer_constant_valid_p (tree value
*** 3604,3615 ****
  		   <= TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (value, 0))))
  	    return initializer_constant_valid_p (TREE_OPERAND (value, 0),
  						 endtype);
  	}
  
!       /* Allow conversions to union types if the value inside is okay.  */
!       if (TREE_CODE (TREE_TYPE (value)) == UNION_TYPE)
  	return initializer_constant_valid_p (TREE_OPERAND (value, 0),
  					     endtype);
        break;
  
      case PLUS_EXPR:
--- 3604,3617 ----
  		   <= TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (value, 0))))
  	    return initializer_constant_valid_p (TREE_OPERAND (value, 0),
  						 endtype);
  	}
  
!       /* Allow conversions to struct or union types if the value
! 	 inside is okay.  */
!       if (TREE_CODE (TREE_TYPE (value)) == RECORD_TYPE
! 	  || TREE_CODE (TREE_TYPE (value)) == UNION_TYPE)
  	return initializer_constant_valid_p (TREE_OPERAND (value, 0),
  					     endtype);
        break;
  
      case PLUS_EXPR:


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