diff options
author | Jakub Jelinek <jakub@redhat.com> | 2019-02-26 11:36:05 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2019-02-26 11:36:05 +0100 |
commit | 0eaf141239b27fa96c41558eab8f5ffba70bed4e (patch) | |
tree | 9a4f4e292ff6910e50766e0cb1c93990d47e6e7a /gcc | |
parent | ba790e6f5ede0967acd57324569715c147b1e870 (diff) | |
download | gcc-0eaf141239b27fa96c41558eab8f5ffba70bed4e.zip gcc-0eaf141239b27fa96c41558eab8f5ffba70bed4e.tar.gz gcc-0eaf141239b27fa96c41558eab8f5ffba70bed4e.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/fortran/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/fortran/trans-array.c | 12 |
2 files changed, 10 insertions, 8 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 16b8eb0..2293c9a 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +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> PR fortran/89174 diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index f15d3a37..6192e68 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -5986,7 +5986,6 @@ gfc_conv_array_initializer (tree type, gfc_expr * expr) { gfc_constructor *c; tree tmp; - offset_int wtmp; gfc_se se; tree index, range; vec<constructor_elt, va_gc> *v = NULL; @@ -6009,13 +6008,10 @@ gfc_conv_array_initializer (tree type, gfc_expr * expr) else gfc_conv_structure (&se, expr, 1); - wtmp = wi::to_offset (TYPE_MAX_VALUE (TYPE_DOMAIN (type))) + 1; - /* This will probably eat buckets of memory for large arrays. */ - while (wtmp != 0) - { - CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, se.expr); - wtmp -= 1; - } + CONSTRUCTOR_APPEND_ELT (v, build2 (RANGE_EXPR, gfc_array_index_type, + TYPE_MIN_VALUE (TYPE_DOMAIN (type)), + TYPE_MAX_VALUE (TYPE_DOMAIN (type))), + se.expr); break; case EXPR_ARRAY: |