Commit a7a6a027 by Janus Weil

re PR fortran/58185 ([OOP] ICE when selector in SELECT TYPE is non-polymorphic)

2013-08-22  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/58185
	* match.c (copy_ts_from_selector_to_associate): Only build class
	container for polymorphic selector. Some cleanup.


2013-08-22  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/58185
	* gfortran.dg/select_type_34.f90: New.

From-SVN: r201919
parent da6ca2b5
2013-08-22 Janus Weil <janus@gcc.gnu.org>
PR fortran/58185
* match.c (copy_ts_from_selector_to_associate): Only build class
container for polymorphic selector. Some cleanup.
2013-08-20 Janus Weil <janus@gcc.gnu.org> 2013-08-20 Janus Weil <janus@gcc.gnu.org>
PR fortran/53655 PR fortran/53655
......
...@@ -5093,7 +5093,6 @@ copy_ts_from_selector_to_associate (gfc_expr *associate, gfc_expr *selector) ...@@ -5093,7 +5093,6 @@ copy_ts_from_selector_to_associate (gfc_expr *associate, gfc_expr *selector)
{ {
gfc_ref *ref; gfc_ref *ref;
gfc_symbol *assoc_sym; gfc_symbol *assoc_sym;
int i;
assoc_sym = associate->symtree->n.sym; assoc_sym = associate->symtree->n.sym;
...@@ -5104,8 +5103,7 @@ copy_ts_from_selector_to_associate (gfc_expr *associate, gfc_expr *selector) ...@@ -5104,8 +5103,7 @@ copy_ts_from_selector_to_associate (gfc_expr *associate, gfc_expr *selector)
while (ref && ref->next) while (ref && ref->next)
ref = ref->next; ref = ref->next;
if (selector->ts.type == BT_CLASS if (selector->ts.type == BT_CLASS && CLASS_DATA (selector)->as
&& CLASS_DATA (selector)->as
&& ref && ref->type == REF_ARRAY) && ref && ref->type == REF_ARRAY)
{ {
/* Ensure that the array reference type is set. We cannot use /* Ensure that the array reference type is set. We cannot use
...@@ -5114,7 +5112,7 @@ copy_ts_from_selector_to_associate (gfc_expr *associate, gfc_expr *selector) ...@@ -5114,7 +5112,7 @@ copy_ts_from_selector_to_associate (gfc_expr *associate, gfc_expr *selector)
if (ref->u.ar.type == AR_UNKNOWN) if (ref->u.ar.type == AR_UNKNOWN)
{ {
ref->u.ar.type = AR_ELEMENT; ref->u.ar.type = AR_ELEMENT;
for (i = 0; i < ref->u.ar.dimen + ref->u.ar.codimen; i++) for (int i = 0; i < ref->u.ar.dimen + ref->u.ar.codimen; i++)
if (ref->u.ar.dimen_type[i] == DIMEN_RANGE if (ref->u.ar.dimen_type[i] == DIMEN_RANGE
|| ref->u.ar.dimen_type[i] == DIMEN_VECTOR || ref->u.ar.dimen_type[i] == DIMEN_VECTOR
|| (ref->u.ar.dimen_type[i] == DIMEN_UNKNOWN || (ref->u.ar.dimen_type[i] == DIMEN_UNKNOWN
...@@ -5133,9 +5131,6 @@ copy_ts_from_selector_to_associate (gfc_expr *associate, gfc_expr *selector) ...@@ -5133,9 +5131,6 @@ copy_ts_from_selector_to_associate (gfc_expr *associate, gfc_expr *selector)
selector->rank = 0; selector->rank = 0;
} }
if (selector->ts.type != BT_CLASS)
{
/* The correct class container has to be available. */
if (selector->rank) if (selector->rank)
{ {
assoc_sym->attr.dimension = 1; assoc_sym->attr.dimension = 1;
...@@ -5146,24 +5141,9 @@ copy_ts_from_selector_to_associate (gfc_expr *associate, gfc_expr *selector) ...@@ -5146,24 +5141,9 @@ copy_ts_from_selector_to_associate (gfc_expr *associate, gfc_expr *selector)
else else
assoc_sym->as = NULL; assoc_sym->as = NULL;
assoc_sym->ts.type = BT_CLASS; if (selector->ts.type == BT_CLASS)
assoc_sym->ts.u.derived = selector->ts.u.derived;
assoc_sym->attr.pointer = 1;
gfc_build_class_symbol (&assoc_sym->ts, &assoc_sym->attr,
&assoc_sym->as, false);
}
else
{ {
/* The correct class container has to be available. */ /* The correct class container has to be available. */
if (selector->rank)
{
assoc_sym->attr.dimension = 1;
assoc_sym->as = gfc_get_array_spec ();
assoc_sym->as->rank = selector->rank;
assoc_sym->as->type = AS_DEFERRED;
}
else
assoc_sym->as = NULL;
assoc_sym->ts.type = BT_CLASS; assoc_sym->ts.type = BT_CLASS;
assoc_sym->ts.u.derived = CLASS_DATA (selector)->ts.u.derived; assoc_sym->ts.u.derived = CLASS_DATA (selector)->ts.u.derived;
assoc_sym->attr.pointer = 1; assoc_sym->attr.pointer = 1;
......
2013-08-22 Janus Weil <janus@gcc.gnu.org>
PR fortran/58185
* gfortran.dg/select_type_34.f90: New.
2013-08-21 Paolo Carlini <paolo.carlini@oracle.com> 2013-08-21 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/56130 PR c++/56130
......
! { dg-do compile }
!
! PR 58185: [4.8/4.9 Regression] [OOP] ICE when selector in SELECT TYPE is non-polymorphic
!
! Contributed by John <jwmwalrus@gmail.com>
integer :: array
select type (a => array) ! { dg-error "Selector shall be polymorphic" }
end select
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment