[patch,fortran] Bug 69497 - ICE in gfc_free_namespace

Jerry DeLisle jvdelisle@charter.net
Sat Mar 24 23:25:00 GMT 2018


On 03/24/2018 02:56 PM, Steve Kargl wrote:
> On Sat, Mar 24, 2018 at 02:25:36PM -0700, Jerry DeLisle wrote:
>>
>> 2018-03-24  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
>> 	    Dominique d'Humieres  <dominiq@gcc.gnu.org>
>>
>> 	PR fortran/84506
>> 	* symbol.c (gfc_free_namespace): Delete the assert and if refs
>> 	count is less than zero, free the namespece. Something is
>> 	halfway	and other errors will resound.
>>
>> diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c
>> index ce6b1e93644..997d90b00fd 100644
>> --- a/gcc/fortran/symbol.c
>> +++ b/gcc/fortran/symbol.c
>> @@ -4037,10 +4037,9 @@ gfc_free_namespace (gfc_namespace *ns)
>>        return;
>>
>>      ns->refs--;
>> -  if (ns->refs > 0)
>> -    return;
>>
>> -  gcc_assert (ns->refs == 0);
>> +  if (ns->refs != 0)
>> +    return;
>>
>>      gfc_free_statements (ns->code);
> 
> The ChangeLog doesn't seem to match the patch.
> 
> If ns->refs==0, you free the namespace.
> If ns->refs!=0, you return.
> So, if ns->refs<0, the namespace is not freed.
> 

That is what I get when I am in hurry. Try this:

	PR fortran/84506
	* symbol.c (gfc_free_namespace): Delete the assert and only if
	refs count equals zero, free the namespece. Otherwise,
	something is halfway and other errors will resound.



More information about the Fortran mailing list