mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-13 22:11:47 +08:00
PR fortran/98284 - ICE in get_array_index
Reject DATA elements with the ALLOCATABLE attribute also when they are components of a derived type. gcc/fortran/ChangeLog: PR fortran/98284 * resolve.c (check_data_variable): Reject DATA elements with the ALLOCATABLE attribute. gcc/testsuite/ChangeLog: PR fortran/98284 * gfortran.dg/pr98284.f90: New test.
This commit is contained in:
parent
134afa38f0
commit
5098d35fb1
@ -16169,6 +16169,13 @@ check_data_variable (gfc_data_variable *var, locus *where)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (ref->type == REF_COMPONENT && ref->u.c.component->attr.allocatable)
|
||||
{
|
||||
gfc_error ("DATA element %qs at %L cannot have the ALLOCATABLE "
|
||||
"attribute", ref->u.c.component->name, &e->where);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (e->rank == 0 || has_pointer)
|
||||
|
12
gcc/testsuite/gfortran.dg/pr98284.f90
Normal file
12
gcc/testsuite/gfortran.dg/pr98284.f90
Normal file
@ -0,0 +1,12 @@
|
||||
! { dg-do compile }
|
||||
! PR fortran/98284 - ICE in get_array_index
|
||||
|
||||
program p
|
||||
implicit none
|
||||
type t
|
||||
integer, allocatable :: h(:)
|
||||
end type t
|
||||
type(t) :: u
|
||||
integer :: i
|
||||
data (u% h(i),i=1,8) /8*1/ ! { dg-error "cannot have the ALLOCATABLE attribute" }
|
||||
end
|
Loading…
x
Reference in New Issue
Block a user