re PR fortran/88871 (ICE segmentation fault in f951)
2019-01-17 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/88871 * resolve.c (resolve_ref): Fix logic for removal of reference. From-SVN: r268092
This commit is contained in:
parent
152f258f9a
commit
b9e25708aa
|
@ -1,3 +1,9 @@
|
||||||
|
2019-01-17 Thomas Koenig <tkoenig@gcc.gnu.org>
|
||||||
|
|
||||||
|
PR fortran/88871
|
||||||
|
* resolve.c (resolve_ref): Fix logic for removal of
|
||||||
|
reference.
|
||||||
|
|
||||||
2019-01-19 Jakub Jelinek <jakub@redhat.com>
|
2019-01-19 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
PR fortran/88902
|
PR fortran/88902
|
||||||
|
|
|
@ -5046,6 +5046,7 @@ resolve_ref (gfc_expr *expr)
|
||||||
int current_part_dimension, n_components, seen_part_dimension;
|
int current_part_dimension, n_components, seen_part_dimension;
|
||||||
gfc_ref *ref, **prev;
|
gfc_ref *ref, **prev;
|
||||||
bool equal_length;
|
bool equal_length;
|
||||||
|
bool breakout;
|
||||||
|
|
||||||
for (ref = expr->ref; ref; ref = ref->next)
|
for (ref = expr->ref; ref; ref = ref->next)
|
||||||
if (ref->type == REF_ARRAY && ref->u.ar.as == NULL)
|
if (ref->type == REF_ARRAY && ref->u.ar.as == NULL)
|
||||||
|
@ -5054,12 +5055,12 @@ resolve_ref (gfc_expr *expr)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
breakout = false;
|
||||||
for (ref = expr->ref, prev = &expr->ref; ref; prev = &ref->next, ref = ref->next)
|
for (prev = &expr->ref; !breakout && *prev != NULL; prev = &(*prev)->next)
|
||||||
switch (ref->type)
|
switch ((*prev)->type)
|
||||||
{
|
{
|
||||||
case REF_ARRAY:
|
case REF_ARRAY:
|
||||||
if (!resolve_array_ref (&ref->u.ar))
|
if (!resolve_array_ref (&(*prev)->u.ar))
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -5069,17 +5070,20 @@ resolve_ref (gfc_expr *expr)
|
||||||
|
|
||||||
case REF_SUBSTRING:
|
case REF_SUBSTRING:
|
||||||
equal_length = false;
|
equal_length = false;
|
||||||
if (!resolve_substring (ref, &equal_length))
|
if (!resolve_substring (*prev, &equal_length))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (expr->expr_type != EXPR_SUBSTRING && equal_length)
|
if (expr->expr_type != EXPR_SUBSTRING && equal_length)
|
||||||
{
|
{
|
||||||
/* Remove the reference and move the charlen, if any. */
|
/* Remove the reference and move the charlen, if any. */
|
||||||
|
ref = *prev;
|
||||||
*prev = ref->next;
|
*prev = ref->next;
|
||||||
ref->next = NULL;
|
ref->next = NULL;
|
||||||
expr->ts.u.cl = ref->u.ss.length;
|
expr->ts.u.cl = ref->u.ss.length;
|
||||||
ref->u.ss.length = NULL;
|
ref->u.ss.length = NULL;
|
||||||
gfc_free_ref_list (ref);
|
gfc_free_ref_list (ref);
|
||||||
|
if (*prev == NULL)
|
||||||
|
breakout = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue