+2006-11-19 Erik Edelmann <eedelman@gcc.gnu.org>
+
+ * resolve.c (resolve_ref): Check for ALLOCATABLEs to the right of
+ nonzero rank part references too.
+
2006-11-19 Francois-Xavier Coudert <coudert@clipper.ens.fr>
* module.c (gfc_use_module): Uncomment the ISO_FORTRAN_ENV code.
break;
case REF_COMPONENT:
- if ((current_part_dimension || seen_part_dimension)
- && ref->u.c.component->pointer)
+ if (current_part_dimension || seen_part_dimension)
{
- gfc_error
- ("Component to the right of a part reference with nonzero "
- "rank must not have the POINTER attribute at %L",
- &expr->where);
- return FAILURE;
+ if (ref->u.c.component->pointer)
+ {
+ gfc_error
+ ("Component to the right of a part reference with nonzero "
+ "rank must not have the POINTER attribute at %L",
+ &expr->where);
+ return FAILURE;
+ }
+ else if (ref->u.c.component->allocatable)
+ {
+ gfc_error
+ ("Component to the right of a part reference with nonzero "
+ "rank must not have the ALLOCATABLE attribute at %L",
+ &expr->where);
+ return FAILURE;
+ }
}
n_components++;
+2006-11-19 Erik Edelmann <eedelman@gcc.gnu.org>
+
+ * gfortran.dg/alloc_comp_constraint_5.f90: New.
+ * gfortran.dg/alloc_comp_assign_2.f90: Removed invalid code.
+
2006-11-19 Francois-Xavier Coudert <coudert@clipper.ens.fr>
* gfortran.dg/use_3.f90: Remove error message.
if (any( (/(((y(k)%at(i)%i(j), j = 1,4), i = 1,2), k = 1,2)/) .ne. &
(/0,0,2,1,11,12,6,5,11,12,3,2,9,8,7,6/))) call abort ()
- where (y((2))%at(:)%i(2) > 8)
- y(2)%at(:)%i(2) = 77
- end where
- if (any ((/(((y(k)%at(i)%i(j), j = 1,4), i = 1,2), k = 1,2)/) .ne. &
- (/0,0,2,1,11,12,6,5,11,77,3,2,9,8,7,6/))) call abort ()
-
! Check that temporaries and full array alloctable component assignments
! are correctly handled in FORALL.
--- /dev/null
+! { dg-do compile }
+! Check that ALLOCATABLE components aren't allowed to the right of a non-zero
+! rank part reference.
+program test
+
+ implicit none
+ type :: foo
+ real, allocatable :: bar(:)
+ end type foo
+ type(foo), target :: x(3)
+ integer :: i
+ real, pointer :: p(:)
+
+ allocate(x(:)%bar(5))! { dg-error "must not have the ALLOCATABLE attribute" }
+ x(:)%bar(1) = 1.0 ! { dg-error "must not have the ALLOCATABLE attribute" }
+ p => x(:)%bar(1) ! { dg-error "must not have the ALLOCATABLE attribute" }
+
+end program test