PR55789 - [4.6/4.7/4.8 Regression] Needless realloc with array constructor

Paul Richard Thomas paul.richard.thomas@gmail.com
Sat Jan 12 15:33:00 GMT 2013


Dear All,

I think that there must be something that I am missing with this PR.

Index: gcc/fortran/trans-array.c
===================================================================
*** gcc/fortran/trans-array.c    (revision 195123)
--- gcc/fortran/trans-array.c    (working copy)
*************** trans_array_constructor (gfc_ss * ss, lo
*** 2307,2315 ****
      }
      }

-   if (TREE_CODE (*loop_ubound0) == VAR_DECL)
-     dynamic = true;
-
    gfc_trans_create_temp_array (&outer_loop->pre, &outer_loop->post, ss, type,
                     NULL_TREE, dynamic, true, false, where);

--- 2307,2312 ----

fixes it and regtests OK.  I just do not understand why the loop
ubound being a variable should ever result in dynamic being true:

According to 4.8 Construction of array values
7 For an ac-implied-do, the loop initialization and execution is the
same as for a DO construct.

Thus, the initial, terminal and incrementation parameters are
evaluated before the loop is initiated and so the loop upper bound
being a variable can have no bearing on whether or not dynamic should
be true.

Cheers

Paul



More information about the Fortran mailing list