mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-01-10 23:55:50 +08:00
re PR fortran/35470 (Valid pointer assigment code gives compilation errors)
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-16 Paul Thomas <pault@gcc.gnu.org> PR fortran/35470 * gfortran.dg/subref_array_pointer_3.f90 : New test. From-SVN: r133279
This commit is contained in:
parent
41ff0d66b3
commit
c52938ec21
@ -1,3 +1,9 @@
|
||||
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
|
||||
|
@ -954,20 +954,12 @@ static int need_full_assumed_size = 0;
|
||||
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 "
|
||||
|
@ -1,3 +1,8 @@
|
||||
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
|
||||
|
15
gcc/testsuite/gfortran.dg/subref_array_pointer_3.f90
Normal file
15
gcc/testsuite/gfortran.dg/subref_array_pointer_3.f90
Normal file
@ -0,0 +1,15 @@
|
||||
! { 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
|
Loading…
Reference in New Issue
Block a user