diff options
author | Thomas Koenig <tkoenig@gcc.gnu.org> | 2018-02-17 15:53:07 +0000 |
---|---|---|
committer | Thomas Koenig <tkoenig@gcc.gnu.org> | 2018-02-17 15:53:07 +0000 |
commit | aab206388590f16862d117eb5b7305586c92cb30 (patch) | |
tree | ddc78ca39acdca2320f2e6933008c5ee7dc897ed /gcc/fortran | |
parent | 7d6ce202609bd8bcbd8618507cef32e793b477e4 (diff) | |
download | gcc-aab206388590f16862d117eb5b7305586c92cb30.zip gcc-aab206388590f16862d117eb5b7305586c92cb30.tar.gz gcc-aab206388590f16862d117eb5b7305586c92cb30.tar.bz2 |
re PR fortran/84270 (optimization bug with assumed size array argument)
2018-02-17 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/84270
* frontend-passes (scalarized_expr): If the expression
is an assumed size array, leave in the last reference
and pass AR_SECTION instead of AR_FULL to gfc_resolve
in order to avoid an error.
2018-02-17 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/84270
* gfortran.dg/inline_matmul_22.f90: New test.
From-SVN: r257783
Diffstat (limited to 'gcc/fortran')
-rw-r--r-- | gcc/fortran/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/fortran/frontend-passes.c | 20 |
2 files changed, 26 insertions, 2 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index af345ea..ce98b76 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,11 @@ +2018-02-17 Thomas Koenig <tkoenig@gcc.gnu.org> + + PR fortran/84270 + * frontend-passes (scalarized_expr): If the expression + is an assumed size array, leave in the last reference + and pass AR_SECTION instead of AR_FULL to gfc_resolve + in order to avoid an error. + 2018-02-17 Paul Thomas <pault@gcc.gnu.org> PR fortran/84115 diff --git a/gcc/fortran/frontend-passes.c b/gcc/fortran/frontend-passes.c index 11a5b9b..d07d142 100644 --- a/gcc/fortran/frontend-passes.c +++ b/gcc/fortran/frontend-passes.c @@ -3567,10 +3567,26 @@ scalarized_expr (gfc_expr *e_in, gfc_expr **index, int count_index) is the lbound of a full ref. */ int j; gfc_array_ref *ar; + int to; ar = &ref->u.ar; - ar->type = AR_FULL; - for (j = 0; j < ar->dimen; j++) + + /* For assumed size, we need to keep around the final + reference in order not to get an error on resolution + below, and we cannot use AR_FULL. */ + + if (ar->as->type == AS_ASSUMED_SIZE) + { + ar->type = AR_SECTION; + to = ar->dimen - 1; + } + else + { + to = ar->dimen; + ar->type = AR_FULL; + } + + for (j = 0; j < to; j++) { gfc_free_expr (ar->start[j]); ar->start[j] = NULL; |