Commit 0eaf1412 by Jakub Jelinek Committed by Jakub Jelinek

re PR fortran/43210 (Initializer of huge static arrays should be improved)

	PR fortran/43210
	* trans-array.c (gfc_conv_array_initializer): Use RANGE_EXPR instead
	of duplicating the initializer possibly many times.

From-SVN: r269207
parent ba790e6f
2019-02-26 Jakub Jelinek <jakub@redhat.com>
PR fortran/43210
* trans-array.c (gfc_conv_array_initializer): Use RANGE_EXPR instead
of duplicating the initializer possibly many times.
2019-02-24 Thomas Koenig <tkoenig@gcc.gnu.org> 2019-02-24 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/89174 PR fortran/89174
......
...@@ -5986,7 +5986,6 @@ gfc_conv_array_initializer (tree type, gfc_expr * expr) ...@@ -5986,7 +5986,6 @@ gfc_conv_array_initializer (tree type, gfc_expr * expr)
{ {
gfc_constructor *c; gfc_constructor *c;
tree tmp; tree tmp;
offset_int wtmp;
gfc_se se; gfc_se se;
tree index, range; tree index, range;
vec<constructor_elt, va_gc> *v = NULL; vec<constructor_elt, va_gc> *v = NULL;
...@@ -6009,13 +6008,10 @@ gfc_conv_array_initializer (tree type, gfc_expr * expr) ...@@ -6009,13 +6008,10 @@ gfc_conv_array_initializer (tree type, gfc_expr * expr)
else else
gfc_conv_structure (&se, expr, 1); gfc_conv_structure (&se, expr, 1);
wtmp = wi::to_offset (TYPE_MAX_VALUE (TYPE_DOMAIN (type))) + 1; CONSTRUCTOR_APPEND_ELT (v, build2 (RANGE_EXPR, gfc_array_index_type,
/* This will probably eat buckets of memory for large arrays. */ TYPE_MIN_VALUE (TYPE_DOMAIN (type)),
while (wtmp != 0) TYPE_MAX_VALUE (TYPE_DOMAIN (type))),
{ se.expr);
CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, se.expr);
wtmp -= 1;
}
break; break;
case EXPR_ARRAY: case EXPR_ARRAY:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment