This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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 Thu, Jul 20, 2006 at 07:52:56PM +0300, Erik Edelmann wrote: > On Thu, Jul 20, 2006 at 12:54:24AM +0200, Steven Bosscher wrote: > > On 7/19/06, Erik Edelmann <erik.edelmann@iki.fi> wrote: > > >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. > > > > Why not, then, check !sym->attr.allocatable in resolve_fl_variable > > (and assert that in gfc_conv_function_call)? Sorry to be a PITA ;-) > > Well, I was in fact heading in the quite opposite direction, to set > sym->value for allocatables too in resolve_fl_variable, and then use > e->symtree->n.sym->value instead of a call to gfc_default_initializer() > when initializing after allocation in resolve.c (resolve_allocate_expr). > The reason I didn't do it immediately was that I decided I would leave > it for a separate patch. After thinking about this some more, I've decided to scrap those plans, and go for Stevens proposed solution instead. (The problem were the pointers; they would have to have the sym->value too (because they are also allocatable), but that leads to errors. Maybe solvable, but I got a feeling that I was opening a can of worms, so I decided to put the lid back on.) New patch, tested on trunk, Linux/x86. Ok? Erik 2006-07-25 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-25 Erik Edelmann <eedelman@gcc.gnu.org> PR fortran/25217 * gfortran.dg/derived_init_2.f90: New.
Attachment:
pr25217.diff
Description: Text document
Attachment:
derived_init_2.f90
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |