[PATCH] Fix PR61950

Richard Biener rguenther@suse.de
Thu Aug 7 08:11:00 GMT 2014


On Thu, 31 Jul 2014, Richard Biener wrote:

> 
> The following fixes PR61950 by properly initializing the _size field
> of the static constructor for the vtable init member.  Previously
> gfortran would use a 64bit integer to initialize the 32bit size field
> (not sure why larger aggregates are not considered).
> 
> This breaks more sophisticated constant-folding and previously
> inhibited constant folding (which would have worked in this case
> been there no mismatch between initializer and field).
> 
> Bootstrap and regtest ongoing on powerpc64-linux-gnu, ok?  I'm not
> considering a backport as it is only a missed optimization there.

Ping?

Thanks,
Richard.

> Thanks,
> Richard.
> 
> 2014-07-31  Richard Biener  <rguenther@suse.de>
> 
> 	* trans-expr.c (gfc_conv_structure): Initialize _size with
> 	a value of proper type.
> 
> Index: gcc/fortran/trans-expr.c
> ===================================================================
> --- gcc/fortran/trans-expr.c	(revision 213342)
> +++ gcc/fortran/trans-expr.c	(working copy)
> @@ -6260,7 +6260,9 @@ gfc_conv_structure (gfc_se * se, gfc_exp
>        else if (cm->ts.u.derived && strcmp (cm->name, "_size") == 0)
>  	{
>  	  val = TYPE_SIZE_UNIT (gfc_get_derived_type (cm->ts.u.derived));
> -	  CONSTRUCTOR_APPEND_ELT (v, cm->backend_decl, val);
> +	  CONSTRUCTOR_APPEND_ELT (v, cm->backend_decl,
> +				  fold_convert (TREE_TYPE (cm->backend_decl),
> +						val));
>  	}
>        else
>  	{
> 

-- 
Richard Biener <rguenther@suse.de>
SUSE / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746
GF: Jeff Hawn, Jennifer Guild, Felix Imend"orffer



More information about the Gcc-patches mailing list