aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/array.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/fortran/array.c')
-rw-r--r--gcc/fortran/array.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/gcc/fortran/array.c b/gcc/fortran/array.c
index 3a504eb..cbeece4 100644
--- a/gcc/fortran/array.c
+++ b/gcc/fortran/array.c
@@ -66,6 +66,7 @@ match_subscript (gfc_array_ref *ar, int init, bool match_star)
match m = MATCH_ERROR;
bool star = false;
int i;
+ bool saw_boz = false;
i = ar->dimen + ar->codimen;
@@ -91,6 +92,12 @@ match_subscript (gfc_array_ref *ar, int init, bool match_star)
else if (!star)
m = gfc_match_expr (&ar->start[i]);
+ if (ar->start[i] && ar->start[i]->ts.type == BT_BOZ)
+ {
+ gfc_error ("Invalid BOZ literal constant used in subscript at %C");
+ saw_boz = true;
+ }
+
if (m == MATCH_NO)
gfc_error ("Expected array subscript at %C");
if (m != MATCH_YES)
@@ -117,6 +124,12 @@ end_element:
else
m = gfc_match_expr (&ar->end[i]);
+ if (ar->end[i] && ar->end[i]->ts.type == BT_BOZ)
+ {
+ gfc_error ("Invalid BOZ literal constant used in subscript at %C");
+ saw_boz = true;
+ }
+
if (m == MATCH_ERROR)
return MATCH_ERROR;
@@ -132,6 +145,12 @@ end_element:
m = init ? gfc_match_init_expr (&ar->stride[i])
: gfc_match_expr (&ar->stride[i]);
+ if (ar->stride[i] && ar->stride[i]->ts.type == BT_BOZ)
+ {
+ gfc_error ("Invalid BOZ literal constant used in subscript at %C");
+ saw_boz = true;
+ }
+
if (m == MATCH_NO)
gfc_error ("Expected array subscript stride at %C");
if (m != MATCH_YES)
@@ -142,7 +161,7 @@ matched:
if (star)
ar->dimen_type[i] = DIMEN_STAR;
- return MATCH_YES;
+ return (saw_boz ? MATCH_ERROR : MATCH_YES);
}