This is the mail archive of the 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] PR28788 - ICE/Segmentation fault with user types, use only and modules(Regression fix)

:ADDPATCH fortran:

This patch fixes two regressions, reported to PR28788.  In both cases, the freeing of the
symbol that has been reassociated is not appropriate.  In one case, because there is
no symbol to free(!) and the other because there are remaining references to the symbol.
I have to confess that I have not been able to uncover all of these latter references and
have found that the only solution is not to free use associated derived types at this stage.
Instead, we wait for gfc_free_namespace to do the job at the end of the compilation. I
have verified that this occurs by counting the derived types in and out again.

It should be noted that the testcase used_types_5.f90 tests the pre-patch, unregressed
version of gfortran to destruction!  In this sense, the fix is not entirely a regression
fix but fixes, as well, a problem that we did not know that we had.  That said, this
uncharted problem is related to the regression.

Regtested on Cygwin_NT/PIV.  Also, Martin Reinecke has been so good as to test the
patch on the working version of the code that produced the problem.  Thanks also to
Jerry DeLisle for testing a provisional version overnight and to Martin Tee for feedback
last week.

I will commit this patch to trunk and 4.1 tomorrow morning, unless I get any contrary

Hopefully that is it....! I believe that the fact that derived type association occurs
in one function, which is generously commented, will ease any future maintainance


2006-08-28  Paul Thomas  <>

	PR fortran/28788
	* symbol.c (gfc_use_derived): Never eliminate the symbol,
	following reassociation of use associated derived types.

2006-08-28  Paul Thomas  <>

	PR fortran/28788
	* gfortran.dg/used_types_5.f90: New test.
	* gfortran.dg/used_types_6.f90: New test.

Attachment: commit0828.msg
Description: commit0828.msg

Attachment: patch0828.diff
Description: patch0828.diff

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