[PATCH] fortran: ICE using undeclared symbol in array constructor, PR93484

Mark Eggleston mark.eggleston@codethink.co.uk
Mon Feb 24 14:19:00 GMT 2020


**ping**

The following was a reply to 
https://gcc.gnu.org/ml/fortran/2020-02/msg00042.html

see response below. OK to commit?
On 11/02/2020 15:23, Steve Kargl wrote:
> On Tue, Feb 11, 2020 at 12:10:41PM +0000, Mark Eggleston wrote:
>> Please find attached a patch for PR93484.  The original author is Steve
>> Kargl. I have added the test cases.
>>
>> OK for master?
> I obviously think the patch is ok, but I'll let someone else review it.
>
>>      Steven G. Kargl  <kargl@gcc.gnu.org>
>>
>>      PR fortran/93484
>>      * match.c (gfc_match_type_spec): Replace gfc_match_init_expr with
>>      gfc_match_expr. Return m if m is MATCH_NO or MATCH_ERROR.
>>
>> diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c
>> index a74cb8c5c19..03adfca9bd9 100644
>> --- a/gcc/fortran/match.c
>> +++ b/gcc/fortran/match.c
>> @@ -2222,9 +2222,9 @@ gfc_match_type_spec (gfc_typespec *ts)
>>   
>>   found:
>>   
>> -      m = gfc_match_init_expr (&e);
>> +      m = gfc_match_expr (&e);
>>         if (m == MATCH_NO || m == MATCH_ERROR)
>> -	return MATCH_NO;
>> +	return m;
> Might need
>
>          gfc_reduce_init_expr (e);
>
> here.  The kind type parameter should be a constant expression.

Not needed. I've also checked use of the kind argument, it is evidently 
checked elsewhere: if k is allowed to be implicitly declared and is used 
as the kind argument errors are reported that it is not a constant, if 
implicit declaration is not allowed a "has no IMPLICIT type" error is 
produced.

>
>>         /* If a comma appears, it is an intrinsic subprogram. */
>>         gfc_gobble_whitespace ();

-- 
https://www.codethink.co.uk/privacy.html



More information about the Fortran mailing list