From 6a68e29dc51525dc6bb8e6e7cb4df6cfa060383c Mon Sep 17 00:00:00 2001 From: Janus Weil Date: Thu, 29 Jul 2010 22:58:57 +0200 Subject: [PATCH] re PR fortran/44962 ([OOP] ICE with specification expression SIZE()) 2010-07-29 Janus Weil PR fortran/44962 * resolve.c (resolve_fl_derived): Call gfc_resolve_array_spec. 2010-07-29 Janus Weil PR fortran/44962 * gfortran.dg/typebound_proc_17.f03: New. From-SVN: r162695 --- gcc/fortran/ChangeLog | 5 ++++ gcc/fortran/resolve.c | 24 +++-------------- gcc/testsuite/ChangeLog | 5 ++++ .../gfortran.dg/typebound_proc_17.f03 | 26 +++++++++++++++++++ 4 files changed, 40 insertions(+), 20 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/typebound_proc_17.f03 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index f22ed116f29..ff7549c7201 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2010-07-29 Janus Weil + + PR fortran/44962 + * resolve.c (resolve_fl_derived): Call gfc_resolve_array_spec. + 2010-07-29 Janus Weil PR fortran/45004 diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index dab533d8242..55cbaf0f071 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -10813,7 +10813,6 @@ resolve_fl_derived (gfc_symbol *sym) { gfc_symbol* super_type; gfc_component *c; - int i; super_type = gfc_get_derived_super_type (sym); @@ -11169,25 +11168,10 @@ resolve_fl_derived (gfc_symbol *sym) && sym != c->ts.u.derived) add_dt_to_dt_list (c->ts.u.derived); - if (c->attr.pointer || c->attr.proc_pointer || c->attr.allocatable - || c->as == NULL) - continue; - - for (i = 0; i < c->as->rank; i++) - { - if (c->as->lower[i] == NULL - || (resolve_index_expr (c->as->lower[i]) == FAILURE) - || !gfc_is_constant_expr (c->as->lower[i]) - || c->as->upper[i] == NULL - || (resolve_index_expr (c->as->upper[i]) == FAILURE) - || !gfc_is_constant_expr (c->as->upper[i])) - { - gfc_error ("Component '%s' of '%s' at %L must have " - "constant array bounds", - c->name, sym->name, &c->loc); - return FAILURE; - } - } + if (gfc_resolve_array_spec (c->as, !(c->attr.pointer + || c->attr.proc_pointer + || c->attr.allocatable)) == FAILURE) + return FAILURE; } /* Resolve the type-bound procedures. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 060b87976b1..76f8a347586 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-07-29 Janus Weil + + PR fortran/44962 + * gfortran.dg/typebound_proc_17.f03: New. + 2010-07-29 Janus Weil PR fortran/45004 diff --git a/gcc/testsuite/gfortran.dg/typebound_proc_17.f03 b/gcc/testsuite/gfortran.dg/typebound_proc_17.f03 new file mode 100644 index 00000000000..5c1a1c30c57 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/typebound_proc_17.f03 @@ -0,0 +1,26 @@ +! { dg-do compile } +! +! PR 44962: [OOP] ICE with specification expression SIZE() +! +! Contributed by Satish.BD + + +module array + +type :: t_array + real, dimension(10) :: coeff +contains + procedure :: get_coeff +end type t_array + +contains + +function get_coeff(self) result(coeff) + class(t_array), intent(in) :: self + real, dimension(size(self%coeff)) :: coeff !! The SIZE here carashes !! +end function get_coeff + +end module array + + +! { dg-final { cleanup-modules "array" } }