Commit 061e60bd by Janus Weil

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
parent 3cfa8f82
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> 2010-10-07 Mikael Morin <mikael@gcc.gnu.org>
PR fortran/45916 PR fortran/45916
......
...@@ -5719,13 +5719,12 @@ resolve_typebound_function (gfc_expr* e) ...@@ -5719,13 +5719,12 @@ resolve_typebound_function (gfc_expr* e)
/* Deal with typebound operators for CLASS objects. */ /* Deal with typebound operators for CLASS objects. */
expr = e->value.compcall.base_object; expr = e->value.compcall.base_object;
if (expr && expr->symtree->n.sym->ts.type == BT_CLASS if (expr && expr->ts.type == BT_CLASS && e->value.compcall.name)
&& e->value.compcall.name)
{ {
/* Since the typebound operators are generic, we have to ensure /* Since the typebound operators are generic, we have to ensure
that any delays in resolution are corrected and that the vtab that any delays in resolution are corrected and that the vtab
is present. */ is present. */
ts = expr->symtree->n.sym->ts; ts = expr->ts;
declared = ts.u.derived; declared = ts.u.derived;
c = gfc_find_component (declared, "$vptr", true, true); c = gfc_find_component (declared, "$vptr", true, true);
if (c->ts.u.derived == NULL) if (c->ts.u.derived == NULL)
......
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> 2010-10-07 Nicola Pero <nicola.pero@meta-innovation.com>
Merge from 'apple/trunk' branch on FSF servers. Merge from 'apple/trunk' branch on FSF servers.
......
! { 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" } }
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