diff options
author | Steven G. Kargl <kargl@gcc.gnu.org> | 2019-06-12 18:28:32 +0000 |
---|---|---|
committer | Steven G. Kargl <kargl@gcc.gnu.org> | 2019-06-12 18:28:32 +0000 |
commit | 974b8e618b52dd1d30ca067e75995fe9fc8e6895 (patch) | |
tree | b5896ea164223e31c79166f4fd93421515a68a6b /gcc/fortran/array.c | |
parent | e97bf6bbbdb43e65cca8509a0f9af681c2a01c2b (diff) | |
download | gcc-974b8e618b52dd1d30ca067e75995fe9fc8e6895.zip gcc-974b8e618b52dd1d30ca067e75995fe9fc8e6895.tar.gz gcc-974b8e618b52dd1d30ca067e75995fe9fc8e6895.tar.bz2 |
re PR fortran/90002 (ICE: free_expr0(): Bad expr type)
2019-06-12 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/90002
* array.c (gfc_free_array_spec): When freeing an array-spec, avoid
an ICE for assumed-shape coarrays
2019-06-12 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/90002
* gfortran.dg/pr90002.f90: New test.
From-SVN: r272201
Diffstat (limited to 'gcc/fortran/array.c')
-rw-r--r-- | gcc/fortran/array.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/gcc/fortran/array.c b/gcc/fortran/array.c index 96732ecd..0aee220 100644 --- a/gcc/fortran/array.c +++ b/gcc/fortran/array.c @@ -324,10 +324,22 @@ gfc_free_array_spec (gfc_array_spec *as) if (as == NULL) return; - for (i = 0; i < as->rank + as->corank; i++) + if (as->corank == 0) { - gfc_free_expr (as->lower[i]); - gfc_free_expr (as->upper[i]); + for (i = 0; i < as->rank; i++) + { + gfc_free_expr (as->lower[i]); + gfc_free_expr (as->upper[i]); + } + } + else + { + int n = as->rank + as->corank - (as->cotype == AS_EXPLICIT ? 1 : 0); + for (i = 0; i < n; i++) + { + gfc_free_expr (as->lower[i]); + gfc_free_expr (as->upper[i]); + } } free (as); |