diff options
Diffstat (limited to 'gcc/fortran/expr.c')
-rw-r--r-- | gcc/fortran/expr.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index 0b0fd09..329bc72 100644 --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -1051,18 +1051,19 @@ find_array_element (gfc_constructor *cons, gfc_array_ref *ar, mpz_mul (span, span, tmp); } - if (cons) - { - for (nelemen = mpz_get_ui (offset); nelemen > 0; nelemen--) - { - if (cons->iterator) - { - cons = NULL; - goto depart; - } - cons = cons->next; - } - } + for (nelemen = mpz_get_ui (offset); nelemen > 0; nelemen--) + { + if (cons) + { + if (cons->iterator) + { + cons = NULL; + + goto depart; + } + cons = cons->next; + } + } depart: mpz_clear (delta); @@ -1341,7 +1342,7 @@ find_array_section (gfc_expr *expr, gfc_ref *ref) cons = base; } - while (mpz_cmp (ptr, index) > 0) + while (cons && cons->next && mpz_cmp (ptr, index) > 0) { mpz_add_ui (index, index, one); cons = cons->next; |