re PR fortran/45933 ([OOP] ICE in gfc_add_component_ref, at fortran/class.c:77)

2010-10-07  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/45933
	* resolve.c (resolve_typebound_function): Use correct declared type
	for type-bound operators.


2010-10-07  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/45933
	* gfortran.dg/typebound_operator_5.f03: New.

From-SVN: r165126
This commit is contained in:
Janus Weil 2010-10-07 19:35:18 +02:00
parent 3cfa8f8272
commit 061e60bd78
4 changed files with 43 additions and 3 deletions

View file

@ -1,3 +1,9 @@
2010-10-07 Janus Weil <janus@gcc.gnu.org>
PR fortran/45933
* resolve.c (resolve_typebound_function): Use correct declared type
for type-bound operators.
2010-10-07 Mikael Morin <mikael@gcc.gnu.org>
PR fortran/45916

View file

@ -5719,13 +5719,12 @@ resolve_typebound_function (gfc_expr* e)
/* Deal with typebound operators for CLASS objects. */
expr = e->value.compcall.base_object;
if (expr && expr->symtree->n.sym->ts.type == BT_CLASS
&& e->value.compcall.name)
if (expr && expr->ts.type == BT_CLASS && e->value.compcall.name)
{
/* Since the typebound operators are generic, we have to ensure
that any delays in resolution are corrected and that the vtab
is present. */
ts = expr->symtree->n.sym->ts;
ts = expr->ts;
declared = ts.u.derived;
c = gfc_find_component (declared, "$vptr", true, true);
if (c->ts.u.derived == NULL)

View file

@ -1,3 +1,8 @@
2010-10-07 Janus Weil <janus@gcc.gnu.org>
PR fortran/45933
* gfortran.dg/typebound_operator_5.f03: New.
2010-10-07 Nicola Pero <nicola.pero@meta-innovation.com>
Merge from 'apple/trunk' branch on FSF servers.

View file

@ -0,0 +1,30 @@
! { dg-do compile }
!
! PR 45933: [4.6 regression] [OOP] ICE in gfc_add_component_ref, at fortran/class.c:77
!
! Contributed by Mark Rashid <mmrashid@ucdavis.edu>
MODULE DEF1
TYPE :: DAT
INTEGER :: NN
CONTAINS
PROCEDURE :: LESS_THAN
GENERIC :: OPERATOR (.LT.) => LESS_THAN
END TYPE
CONTAINS
LOGICAL FUNCTION LESS_THAN(A, B)
CLASS (DAT), INTENT (IN) :: A, B
LESS_THAN = (A%NN .LT. B%NN)
END FUNCTION
END MODULE
PROGRAM P
USE DEF1
TYPE NODE
TYPE (DAT), POINTER :: PT
END TYPE
CLASS (NODE),POINTER :: A, B
PRINT *, A%PT .LT. B%PT
END
! { dg-final { cleanup-modules "DEF1" } }