aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/resolve.cc
diff options
context:
space:
mode:
authorHarald Anlauf <anlauf@gmx.de>2023-08-21 21:23:57 +0200
committerHarald Anlauf <anlauf@gmx.de>2023-08-22 09:44:33 +0200
commitd3b5a1bccc219680dc19281b6fd6cc798bb679eb (patch)
treedb4ef44ebae51cdd76d678922828520b40a55d66 /gcc/fortran/resolve.cc
parentc27f06260b248062c3b22f3963858ce3e1ee1882 (diff)
downloadgcc-d3b5a1bccc219680dc19281b6fd6cc798bb679eb.zip
gcc-d3b5a1bccc219680dc19281b6fd6cc798bb679eb.tar.gz
gcc-d3b5a1bccc219680dc19281b6fd6cc798bb679eb.tar.bz2
Fortran: implement vector sections in DATA statements [PR49588]
gcc/fortran/ChangeLog: PR fortran/49588 * data.cc (gfc_advance_section): Derive next index set and next offset into DATA variable also for array references using vector sections. Use auxiliary array to keep track of offsets into indexing vectors. (gfc_get_section_index): Set up initial indices also for DATA variables with array references using vector sections. * data.h (gfc_get_section_index): Adjust prototype. (gfc_advance_section): Likewise. * resolve.cc (check_data_variable): Pass vector offsets. gcc/testsuite/ChangeLog: PR fortran/49588 * gfortran.dg/data_vector_section.f90: New test.
Diffstat (limited to 'gcc/fortran/resolve.cc')
-rw-r--r--gcc/fortran/resolve.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc
index f51674f..ce8261d 100644
--- a/gcc/fortran/resolve.cc
+++ b/gcc/fortran/resolve.cc
@@ -16765,6 +16765,7 @@ check_data_variable (gfc_data_variable *var, locus *where)
ar_type mark = AR_UNKNOWN;
int i;
mpz_t section_index[GFC_MAX_DIMENSIONS];
+ int vector_offset[GFC_MAX_DIMENSIONS];
gfc_ref *ref;
gfc_array_ref *ar;
gfc_symbol *sym;
@@ -16888,7 +16889,7 @@ check_data_variable (gfc_data_variable *var, locus *where)
case AR_SECTION:
ar = &ref->u.ar;
/* Get the start position of array section. */
- gfc_get_section_index (ar, section_index, &offset);
+ gfc_get_section_index (ar, section_index, &offset, vector_offset);
mark = AR_SECTION;
break;
@@ -16971,7 +16972,7 @@ check_data_variable (gfc_data_variable *var, locus *where)
/* Modify the array section indexes and recalculate the offset
for next element. */
else if (mark == AR_SECTION)
- gfc_advance_section (section_index, ar, &offset);
+ gfc_advance_section (section_index, ar, &offset, vector_offset);
}
}