diff options
author | Steven G. Kargl <kargl@gcc.gnu.org> | 2019-10-22 18:38:30 +0000 |
---|---|---|
committer | Steven G. Kargl <kargl@gcc.gnu.org> | 2019-10-22 18:38:30 +0000 |
commit | ddc4d2355ffe484b048c78c47a994afc6d141abb (patch) | |
tree | 748b443d3741c53c05caa5adcf059fd690a0ea96 | |
parent | 41dd40c44022ce8265bd4274fc25dcdc8c2f737a (diff) |
2019-10-22 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/92174
* decl.c (attr_decl1): Move check for F2018:C822 from here ...
* array.c (gfc_set_array_spec): ... to here.
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-9-branch@277298 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/fortran/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/fortran/array.c | 14 | ||||
-rw-r--r-- | gcc/fortran/decl.c | 8 |
3 files changed, 20 insertions, 8 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 6c23d995ef8..4113fc89751 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2019-10-22 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/92174 + * decl.c (attr_decl1): Move check for F2018:C822 from here ... + * array.c (gfc_set_array_spec): ... to here. + 2019-10-18 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/69455 diff --git a/gcc/fortran/array.c b/gcc/fortran/array.c index c1342c7c844..6d20cbb9d36 100644 --- a/gcc/fortran/array.c +++ b/gcc/fortran/array.c @@ -843,6 +843,10 @@ gfc_set_array_spec (gfc_symbol *sym, gfc_array_spec *as, locus *error_loc) sym->as->cotype = as->cotype; sym->as->corank = as->corank; + /* Check F2018:C822. */ + if (sym->as->rank + sym->as->corank > GFC_MAX_DIMENSIONS) + goto too_many; + for (i = 0; i < as->corank; i++) { sym->as->lower[sym->as->rank + i] = as->lower[i]; @@ -861,6 +865,10 @@ gfc_set_array_spec (gfc_symbol *sym, gfc_array_spec *as, locus *error_loc) sym->as->cray_pointee = as->cray_pointee; sym->as->cp_was_assumed = as->cp_was_assumed; + /* Check F2018:C822. */ + if (sym->as->rank + sym->as->corank > GFC_MAX_DIMENSIONS) + goto too_many; + for (i = 0; i < sym->as->corank; i++) { sym->as->lower[as->rank + i] = sym->as->lower[i]; @@ -875,6 +883,12 @@ gfc_set_array_spec (gfc_symbol *sym, gfc_array_spec *as, locus *error_loc) free (as); return true; + +too_many: + + gfc_error ("rank + corank of %qs exceeds %d at %C", sym->name, + GFC_MAX_DIMENSIONS); + return false; } diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index 24002ed1c6e..52a98cd44ed 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -8490,14 +8490,6 @@ attr_decl1 (void) goto cleanup; } - /* Check F2018:C822. */ - if (sym->attr.dimension && sym->attr.codimension - && sym->as && sym->as->rank + sym->as->corank > 15) - { - gfc_error ("rank + corank of %qs exceeds 15 at %C", sym->name); - return MATCH_ERROR; - } - if (sym->attr.cray_pointee && sym->as != NULL) { /* Fix the array spec. */ |