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, fortran] PR28630 - ICE on reexport of renamed type


:ADDPATCH fortran:

FX,

I missed this one completely when doing PR28630 - the required 
modification to the patch is trivial:

We need to recurse into gfc_use_derived for all the derived type 
components and the problem is fixed.  The extra testcase is that
which you contributed.

As mentioned in my previous email, I missed a regression that
occurred on allocating use associated derived types or their
components. This was fixed by adding a call to gfc_match_allocate
that checks that the derived types being allocated are properly
associated.

The enclosed patch applies to both PRs.

It regtests on Cygwin_NT/PIV - OK for trunk and 4.1?

Paul

2006-08-09 Paul Thomas <pault@gcc.gnu.org>

	PR fortran/28601
	PR fortran/28630
	* gfortran.h : Eliminate gfc_dt_list structure and reference
	to it in gfc_namespace.
	* resolve.c (resolve_fl_derived): Remove the building of the
	list of derived types for the current namespace.
	* symbol.c (find_renamed_type): New function to find renamed
	derived types by symbol name rather than symtree name.
	(gfc_use_derived): Search parent namespace for identical
	derived type and use it, even if local version is complete,
	except in interface bodies. Ensure that renamed derived types
	are found by call to find_renamed_type. Recurse for derived
	type components.
	(gfc_free_dt_list): Remove.
	(gfc_free_namespace): Remove call to previous.
	* trans-types.c (copy_dt_decls_ifequal): Remove.
	(gfc_get_derived_type): Remove all the paraphenalia for
	association of derived types, including calls to previous.
	* match.c (gfc_match_allocate): Call gfc_use_derived to
	associate any derived types that are being allocated.

2006-08-09 Paul Thomas <pault@gcc.gnu.org>

	PR fortran/28630
	* gfortran.dg/used_types_2.f90: New test.

	PR fortran/28601
	* gfortran.dg/used_types_3.f90: New test.

> 
> This problem created a really horrible feeling of deja vu. It
> is nearly identical to PR19362, PR20244, P25391 and friends,
> except that it is a derived type function that causes the fun
> instead of a variable.
> 
> I quickly fixed the problem in the same fashion as the previous
> PRs but decided, instead, to do a proper job and clean out the
> dog's dinner that I had left in trans_types.c from the previous
> fixes. (It was not so bad but it just did not look right sitting
> in trans-types.c and had been on my conscience ever since.).
> 
> I knew at the time that the association of derived types should
> be possible in the front-end but was unable to find a way to
> implement it.  Looking at the attached patch, I am not sure why
> I found it so difficult.
> 
> The trick turned out to do some fairly simple modifications to
> symbol.c(gfc_use_derived) that force a check in the parent
> namespace, if it exists, for identical derived types, including
> those use associated derived types that have been renamed. Most
> of the contained, derived type symbols are cleaned up on the
> spot, except those that have been renamed. This latter group
> have to wait for the general clean up at the end of compilation
> because the search for them turned out to be complicated by the
> possibility of multiple associations to the same use associated
> derived type (see used_dummy_types_2.f90 for examples of this).
> The testcase is a deja-gnu-ified version of the testcase
> submitted to the list.
> 
> Regtested on Cygwin_NT/PIV.  Also, I have built and tested
> tonto-2.3 with the patch; this uncovered a problem with
> interfaces and provides a comprehensive check that type
> association is working correctly.
> 
> OK for trunk and 4.1?
> 
> Paul
> 
> 2006-08-06 Paul Thomas <pault@gcc.gnu.org>
> 
> 	PR fortran/28630
> 	* gfortran.h : Eliminate gfc_dt_list structure and the
> 	reference to it in gfc_namespace.
> 	* resolve.c (resolve_fl_derived): Remove the building of
> 	the list of derived types for the current namespace.
> 	* symbol.c (find_renamed_type): New function to find
> 	renamed derived types by symbol name rather than symtree
> 	name.
> 	(gfc_use_derived): Search parent namespace for identical
> 	derived type and use it, even if local version is complete,
> 	except in interface bodies. Ensure that renamed derived
> 	types are found by call to find_renamed_type.
> 	(gfc_free_dt_list): Remove.
> 	(gfc_free_namespace): Remove call to previous.
> 	* trans-types.c (copy_dt_decls_ifequal): Remove.
> 	(gfc_get_derived_type): Remove all the paraphenalia for
> 	association of derived types, including calls to previous.
> 
> 2006-08-06 Paul Thomas <pault@gcc.gnu.org>
> 
> 	PR fortran/28630
> 	* gfortran.dg/used_types_2.f90: New test.
> 
> 
>  
> 

Attachment: pr28601.diff
Description: pr28601.diff

Attachment: Change.Logs
Description: Change.Logs


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