gcc/fortran/ChangeLog:
* trans-stmt.c (gfc_trans_deallocate): Style fix. Allow for NULL
pointer in ref.
* trans-types.c (gfc_get_array_type_bounds): Explicit test for
codimen if shared coarrays are used.
{
gfc_ref *ref, *last;
- for (ref = expr->ref, last = ref; ref; last = ref, ref = ref->next);
+ for (ref = expr->ref, last = ref; ref; last = ref, ref = ref->next)
+ ;
+
ref = last;
- if (ref->type == REF_ARRAY && ref->u.ar.codimen)
+ if (ref && ref->type == REF_ARRAY && ref->u.ar.codimen)
{
gfc_symbol *sym = expr->symtree->n.sym;
int alloc_type = gfc_native_coarray_get_allocation_type (sym);
/* TODO: known offsets for descriptors. */
GFC_TYPE_ARRAY_OFFSET (fat_type) = NULL_TREE;
- if (flag_coarray != GFC_FCOARRAY_SHARED && dimen == 0)
+ if ((flag_coarray != GFC_FCOARRAY_SHARED && dimen == 0)
+ || (flag_coarray == GFC_FCOARRAY_SHARED && dimen == 0 && codimen == 0))
{
arraytype = build_pointer_type (etype);
if (restricted)