Fix fortran/93686 -- ICE matching data statements with derived-type pointers.

gcc/fortran/ChangeLog:

2020-04-06  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/93686
	* decl.c (gfc_match_data): Handle data matching for derived type
	pointers.

gcc/testsuite/ChangeLog:

2020-04-06  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/93686
	* gfortran.dg/pr93686_1.f90: New test.
	* gfortran.dg/pr93686_2.f90: Likewise.
	* gfortran.dg/pr93686_3.f90: Likewise.
	* gfortran.dg/pr93686_4.f90: Likewise.
This commit is contained in:
Fritz Reese 2020-04-06 16:14:29 -04:00
parent 130f703da0
commit d42a2e465d
7 changed files with 55 additions and 0 deletions

View file

@ -1,3 +1,9 @@
2020-04-06 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/93686
* decl.c (gfc_match_data): Handle data matching for derived type
pointers.
2020-04-02 Tobias Burnus <tobias@codesourcery.com>
* gfortran.h (gfc_resolve_formal_arglist): Add prototype.

View file

@ -696,6 +696,10 @@ gfc_match_data (void)
/* F2008:C567 (R536) A data-i-do-object or a variable that appears
as a data-stmt-object shall not be an object designator in which
a pointer appears other than as the entire rightmost part-ref. */
if (!e->ref && e->ts.type == BT_DERIVED
&& e->symtree->n.sym->attr.pointer)
goto partref;
ref = e->ref;
if (e->symtree->n.sym->ts.type == BT_DERIVED
&& e->symtree->n.sym->attr.pointer

View file

@ -1,3 +1,11 @@
2020-04-06 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/93686
* gfortran.dg/pr93686_1.f90: New test.
* gfortran.dg/pr93686_2.f90: Likewise.
* gfortran.dg/pr93686_3.f90: Likewise.
* gfortran.dg/pr93686_4.f90: Likewise.
2020-04-06 Joel Brobecker <brobecker@adacore.com>
* gcc.target/arm/div64-unwinding.c: Skip on vxworks_kernel targets.

View file

@ -0,0 +1,10 @@
! { dg-do compile }
! PR fortran/93686
program p
type t
integer :: a
end type
type(t), pointer :: x
data x /t(2)/ ! { dg-error "part-ref with pointer attribute near ... is not rightmost part-ref of data-stmt-object" }
end

View file

@ -0,0 +1,10 @@
! { dg-do compile }
! PR fortran/93686
program p
type t
integer :: a = 1
end type
type(t), pointer :: x
data x /t(2)/ ! { dg-error "part-ref with pointer attribute near ... is not rightmost part-ref of data-stmt-object" }
end

View file

@ -0,0 +1,9 @@
! { dg-do compile }
! PR fortran/93686
program p
type t
end type
type(t), pointer :: x
data x /t()/ ! { dg-error "part-ref with pointer attribute near ... is not rightmost part-ref of data-stmt-object" }
end

View file

@ -0,0 +1,8 @@
! { dg-do compile }
! PR fortran/93686
type t
end type
type(t), pointer :: x
data x / ! { dg-error "part-ref with pointer attribute near ... is not rightmost part-ref of data-stmt-object" }
end