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] |
On Wed, Jul 19, 2006 at 12:19:47AM +0200, Steven Bosscher wrote: > On Tuesday 18 July 2006 22:35, Erik Edelmann wrote: > > :ADDPATCH fortran: > > > > Here's a fix for PR 25217; INTENT(OUT) arguments of derived type with > > default initializers weren't (re)initialized upon procedure entry. > > This patch adds code to assign the initializer to the argument in > > trans-expr.c (gfc_conv_function_call). > > > > Bootstrapped and reg. tested on trunk, Linux/x86. Ok? > > Ok for 4.1 when/if testing passes? > > Would it not be better to set the sym->value for the derived type > dummy arg in resolve_fl_variable, and then expand that later on in > trans-expr? That way you (should) see the initializer if you dump > the fortran parse tree (-fdump-parse-tree). I agree that that would be a good idea. Here's a new patch that: 1. In resolve.c (resolve_fl_variable), set a default initializer for derived type dummies with INTENT(OUT) even if 'flag' is true. 2. In trans-expr.c (gfc_conv_function_call), the default initializer of the dummy is then assigned to the argument. Another change since last time is a check for ALLOCATABLEs; them we shouldn't initialize, because they will be deallocated at this stage. Erik 2006-07-19 Erik Edelmann <eedelman@gcc.gnu.org> PR fortran/25217 * resolve.c (resolve_fl_variable): Set a default initializer for derived types with INTENT(OUT) even if 'flag' is true. * trans-expr.c (gfc_conv_function_call): Insert code to reinitialize INTENT(OUT) arguments of derived type with default initializers. 2006-07-19 Erik Edelmann <eedelman@gcc.gnu.org> * gfortran.dg/derived_init_2.f90: New.
Attachment:
derived_init_2.f90
Description: Text document
Attachment:
pr25217.diff
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |