https://gcc.gnu.org/ml/fortran/2016-08/msg00014.html On Thu, Aug 4, 2016 at 2:07 PM, Fritz Reese <fritzore...@gmail.com> wrote: > ... > To increase usability and compatibility I have thus a patch which > introduces a new flag -finit-derived into GNU Fortran, allowing > initialization of automatic derived-type and structure variables. With > the patch GNU Fortran generates initializers for structure/derived > type components as if they were local variables of the same type, > according to the other initialization flags (-finit-local-zero, > finit-real=, -finit-integer=, etc...). > ...
Still waiting on a review for this patch. Comments/concerns from all are welcome. > ... > Bootstraps and passes all tests (including the several shipped with > it) on x86_64-redhat-linux. If it is ok for trunk I will commit. > ... > 2016-08-04 Fritz Reese <fritzore...@gmail.com> > > gcc/fortran/ > * lang.opt, invoke.texi: New flag -finit-derived. > * gfortran.h (gfc_build_default_init_expr, gfc_apply_init, > gfc_generate_initializer): New prototypes. > * expr.c (gfc_build_default_init_expr, gfc_apply_init, > component_initializer, gfc_generate_initializer): New functions. > * expr.c (gfc_default_initializer): Wrap gfc_generate_initializer. > * decl.c (build_struct): Move common code to gfc_apply_init. > * resolve.c (can_generate_init): New function. > * resolve.c (build_default_init_expr): Wrap > gfc_build_default_init_expr. > * resolve.c (apply_default_init, resolve_fl_variable_derived): Use > gfc_generate_initializer. > * trans-decl.c (gfc_generate_function_code): Use > gfc_generate_initializer. > > gcc/testsuite/gfortran.dg/ > * init_flag_13.f90: New testcase. > * init_flag_14.f90: Ditto. > * init_flag_15.f03: Ditto. > * dec_init_1.f90: Ditto. > * dec_init_2.f90: Ditto. --- Fritz Reese