[Path, fortran] PR35959 - Recursive function with allocatable array

Paul Richard Thomas paul.richard.thomas@gmail.com
Thu Apr 17 23:22:00 GMT 2008


:ADDPATCH fortran:

This is a bug that I caused.  Default initializers of derived types
with allocatable components were being applied by making them static.
This was OK up to the point where recursive procedures come into the
picture.  Instead of a new instance of local variables fo each scope,
we wound up with one, in this case, and the reporter's test fails.
The fix is to use an existing initialization procedure in trans-decl.c
and to apply it after nullification of the allocatable components.
Two existing tests have to be modified to allow for the increased
occurrences of builtin_free.  The testcase is essentially the
reporter's.

Bootstrapped and regtested on x86_ia64/fc8 - OK for trunk and 4.3?

Paul

2008-04-17  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/35959
	* trans-decl.c (gfc_init_default_dt): Add gfc_ prefix to name
	and allow for NULL body.  Change all references from
	init_default_dt to gfc_init_default_dt.
	* trans.h : Add prototype for gfc_init_default_dt.
	* trans-array.c (gfc_trans_deferred_vars): After nullification
	call gfc_init_default_dt for derived types with allocatable
	components.

2008-04-17  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/35959
	* gfortran.dg/alloc_comp_default_init_2.f90: New test.
	* gfortran.dg/alloc_comp_basics_1.f90: Change occurrences of
	"builtin_free" to 27.
	* gfortran.dg/alloc_comp_constructor_1.f90: Change occurrences
	of "builtin_free" to 21.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: submit.diff
Type: text/x-patch
Size: 7162 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20080417/4e538b68/attachment.bin>


More information about the Gcc-patches mailing list