The attached patch makes -finit-<type>=<constant> generate default
initialization for automatic arrays.
It was OK for the trunk - is it also OK for the 4.6 branch ?
Strictly speaking, it doesn't fix a regression, it is a fix for a
(non-default) debugging option.
2011-12-19 Toon Moene <t...@moene.org>
PR fortran/51310
* resolve.c (build_default_init_expr): Allow non-allocatable,
non-compile-time-constant-shape arrays to have a default
initializer.
* invoke.texi: Delete the restriction on automatic arrays not
being initialized by -finit-<type>=<constant>.
--
Toon Moene - e-mail: t...@moene.org - phone: +31 346 214290
Saturnushof 14, 3738 XG Maartensdijk, The Netherlands
At home: http://moene.org/~toon/; weather: http://moene.org/~hirlam/
Progress of GNU Fortran: http://gcc.gnu.org/wiki/GFortran#news
*** resolve.c.orig 2011-12-13 13:23:59.488029519 +0000
--- resolve.c 2011-12-13 13:24:37.098239361 +0000
*************** build_default_init_expr (gfc_symbol *sym
*** 9899,9905 ****
int i;
/* These symbols should never have a default initialization. */
! if ((sym->attr.dimension && !gfc_is_compile_time_shape (sym->as))
|| sym->attr.external
|| sym->attr.dummy
|| sym->attr.pointer
--- 9899,9905 ----
int i;
/* These symbols should never have a default initialization. */
! if (sym->attr.allocatable
|| sym->attr.external
|| sym->attr.dummy
|| sym->attr.pointer
Index: invoke.texi
===================================================================
--- invoke.texi (revision 182127)
+++ invoke.texi (working copy)
@@ -1474,8 +1474,6 @@
value) options. These options do not initialize
@itemize @bullet
@item
-automatic arrays
-@item
allocatable arrays
@item
components of derived type variables