From 21a032ccde7bd5cc5aa48747444febef7a52cfe7 Mon Sep 17 00:00:00 2001 From: janus Date: Sun, 4 Sep 2011 10:49:13 +0000 Subject: [PATCH] 2011-09-04 Janus Weil PR fortran/50227 * trans-types.c (gfc_sym_type): Check for proc_name. 2011-09-04 Janus Weil PR fortran/50227 * gfortran.dg/class_45a.f03: New. * gfortran.dg/class_45b.f03: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@178509 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/ChangeLog | 5 +++++ gcc/fortran/trans-types.c | 3 ++- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/gfortran.dg/class_45a.f03 | 28 ++++++++++++++++++++++++++++ gcc/testsuite/gfortran.dg/class_45b.f03 | 14 ++++++++++++++ 5 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gfortran.dg/class_45a.f03 create mode 100644 gcc/testsuite/gfortran.dg/class_45b.f03 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 397aa77..b8c5e01 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2011-09-04 Janus Weil + + PR fortran/50227 + * trans-types.c (gfc_sym_type): Check for proc_name. + 2011-08-30 Tobias Burnus PR fortran/45044 diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c index f66878a..43f1a19 100644 --- a/gcc/fortran/trans-types.c +++ b/gcc/fortran/trans-types.c @@ -2109,7 +2109,8 @@ gfc_sym_type (gfc_symbol * sym) { /* We must use pointer types for potentially absent variables. The optimizers assume a reference type argument is never NULL. */ - if (sym->attr.optional || sym->ns->proc_name->attr.entry_master) + if (sym->attr.optional + || (sym->ns->proc_name && sym->ns->proc_name->attr.entry_master)) type = build_pointer_type (type); else { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3b6556d..e60b884 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2011-09-04 Janus Weil + + PR fortran/50227 + * gfortran.dg/class_45a.f03: New. + * gfortran.dg/class_45b.f03: New. + 2011-09-04 Jakub Jelinek Ira Rosen diff --git a/gcc/testsuite/gfortran.dg/class_45a.f03 b/gcc/testsuite/gfortran.dg/class_45a.f03 new file mode 100644 index 0000000..af8932a --- /dev/null +++ b/gcc/testsuite/gfortran.dg/class_45a.f03 @@ -0,0 +1,28 @@ +! { dg-do compile } +! +! PR 50227: [4.7 Regression] [OOP] ICE-on-valid with allocatable class variable +! +! Contributed by Andrew Benson + +module G_Nodes + private + + type, public :: t0 + end type + + type, public, extends(t0) :: t1 + end type + +contains + + function basicGet(self) + implicit none + class(t0), pointer :: basicGet + class(t0), intent(in) :: self + select type (self) + type is (t1) + basicGet => self + end select + end function basicGet + +end module G_Nodes diff --git a/gcc/testsuite/gfortran.dg/class_45b.f03 b/gcc/testsuite/gfortran.dg/class_45b.f03 new file mode 100644 index 0000000..e37fa96 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/class_45b.f03 @@ -0,0 +1,14 @@ +! { dg-do run } +! { dg-additional-sources class_45a.f03 } +! +! PR 50227: [4.7 Regression] [OOP] ICE-on-valid with allocatable class variable +! +! Contributed by Andrew Benson + +program Test + use G_Nodes + class(t0), allocatable :: c + allocate(t1 :: c) +end program Test + +! { dg-final { cleanup-modules "G_Nodes" } } -- 2.7.4