Message ID | 4c520b3f-0645-edac-0eda-e19621407f78@netcologne.de |
---|---|
State | New |
Headers | show |
Series | [fortran] Fix handling of assumed-size arrays in inline matmul | expand |
Am 12.02.2018 um 11:46 schrieb Thomas Koenig: > Hello world, > > the attached patch fixes a regression where a rejects-valid would > be issued. > > OK for the affected branches, trunk and gcc-7? PING ** (5.D0/7.D0) ?
On 02/17/2018 06:22 AM, Thomas Koenig wrote: > Am 12.02.2018 um 11:46 schrieb Thomas Koenig: >> Hello world, >> >> the attached patch fixes a regression where a rejects-valid would >> be issued. >> >> OK for the affected branches, trunk and gcc-7? > > PING ** (5.D0/7.D0) ? > > Yes, OK Jerry
Index: frontend-passes.c =================================================================== --- frontend-passes.c (Revision 257347) +++ frontend-passes.c (Arbeitskopie) @@ -3567,11 +3567,27 @@ scalarized_expr (gfc_expr *e_in, gfc_expr **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; gfc_free_expr (ar->end[j]);