+2008-03-16 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/35470
+ * resolve.c (check_assumed_size_reference): Only visit the
+ first reference and look directly at the highest dimension.
+
2008-03-15 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/35184
static bool
check_assumed_size_reference (gfc_symbol *sym, gfc_expr *e)
{
- gfc_ref *ref;
- int dim;
- int last = 1;
-
if (need_full_assumed_size || !(sym->as && sym->as->type == AS_ASSUMED_SIZE))
return false;
- for (ref = e->ref; ref; ref = ref->next)
- if (ref->type == REF_ARRAY)
- for (dim = 0; dim < ref->u.ar.as->rank; dim++)
- last = (ref->u.ar.end[dim] == NULL)
- && (ref->u.ar.type == DIMEN_ELEMENT);
-
- if (last)
+ if ((e->ref->u.ar.end[e->ref->u.ar.as->rank - 1] == NULL)
+ && (e->ref->u.ar.as->type == AS_ASSUMED_SIZE)
+ && (e->ref->u.ar.type == DIMEN_ELEMENT))
{
gfc_error ("The upper bound in the last dimension must "
"appear in the reference to the assumed size "
+2008-03-16 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/35470
+ * gfortran.dg/subref_array_pointer_3.f90 : New test.
+
2008-03-16 Richard Guenther <rguenther@suse.de>
PR middle-end/35607
--- /dev/null
+! { dg-do compile }
+! Tests the fix for PR35470, in which the pointer assignment would fail
+! because the assumed size 'arr' would get mixed up with the component
+! 'p' in the check for the upper bound of an assumed size array.
+!
+! Contributed by Antony Lewis <antony@cosmologist.info>
+!
+subroutine sub(arr)
+ type real_pointer
+ real, pointer :: p(:)
+ end type real_pointer
+ type(real_pointer), dimension(*) :: arr
+ real, pointer :: p(:)
+ p => arr(1)%p
+end subroutine