[Bug fortran/93792] [10 Regression] ICE in gfc_code2string, at fortran/misc.c:281

kargl at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Feb 18 02:45:00 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93792

--- Comment #2 from kargl at gcc dot gnu.org ---
(In reply to kargl from comment #1)
> This patch is against svn r280157.  The patch fixes the ICE.
> Someone will need to convert the example code into a test
> for the testsuite.
> 
> It seems PDT are handled differently than other components in
> a user-defined derived type.
> 
> Index: gcc/fortran/decl.c
> ===================================================================
> --- gcc/fortran/decl.c	(revision 280157)
> +++ gcc/fortran/decl.c	(working copy)
> @@ -2913,7 +2913,16 @@ variable_decl (int elem)
>  	  goto cleanup;
>  	}
>        else if (param && initializer)
> -	param->value = gfc_copy_expr (initializer);
> +	{
> +	  if (initializer && initializer->ts.type == BT_BOZ)

The test for 'initializer' can be omitted as the 'else if'
has already tested that its a valid pointer.  Sorry about
the sloppiness, but I've moved this snippet through four
different files.

> +	    {
> +	      gfc_error ("BOZ literal constant at %L cannot appear as an "
> +			 "initializer", &initializer->where);
> +	      m = MATCH_ERROR;
> +      	      goto cleanup;
> +	    }
> +	  param->value = gfc_copy_expr (initializer);
> +	}
>      }
>  
>    /* Before adding a possible initilizer, do a simple check for
> compatibility


More information about the Gcc-bugs mailing list