From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25809 invoked by alias); 5 Nov 2009 14:28:15 -0000 Received: (qmail 25760 invoked by uid 48); 5 Nov 2009 14:28:00 -0000 Date: Thu, 05 Nov 2009 14:28:00 -0000 Message-ID: <20091105142800.25759.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug fortran/41556] Errors in applying operator/assignment to an abstract type In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "janus at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2009-11/txt/msg00426.txt.bz2 ------- Comment #7 from janus at gcc dot gnu dot org 2009-11-05 14:27 ------- Here is a patch which fixes both errors in comment #5, and thereby makes the test case in comment #0 compile cleanly: Index: gcc/fortran/interface.c =================================================================== --- gcc/fortran/interface.c (revision 153933) +++ gcc/fortran/interface.c (working copy) @@ -2574,13 +2574,16 @@ matching_typebound_op (gfc_expr** tb_base, gfc_actual_arglist* base; for (base = args; base; base = base->next) - if (base->expr->ts.type == BT_DERIVED) + if (base->expr->ts.type == BT_DERIVED || base->expr->ts.type == BT_CLASS) { gfc_typebound_proc* tb; gfc_symbol* derived; gfc_try result; - derived = base->expr->ts.u.derived; + if (base->expr->ts.type == BT_CLASS) + derived = base->expr->ts.u.derived->components->ts.u.derived; + else + derived = base->expr->ts.u.derived; if (op == INTRINSIC_USER) { @@ -2837,7 +2840,7 @@ gfc_extend_assign (gfc_code *c, gfc_namespace *ns) rhs = c->expr2; /* Don't allow an intrinsic assignment to be replaced. */ - if (lhs->ts.type != BT_DERIVED + if (lhs->ts.type != BT_DERIVED && lhs->ts.type != BT_CLASS && (rhs->rank == 0 || rhs->rank == lhs->rank) && (lhs->ts.type == rhs->ts.type || (gfc_numeric_ts (&lhs->ts) && gfc_numeric_ts (&rhs->ts)))) I will regtest this now and (if successful) commit as obvious. -- janus at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|unassigned at gcc dot gnu |janus at gcc dot gnu dot org |dot org | Status|NEW |ASSIGNED Last reconfirmed|2009-10-06 13:22:14 |2009-11-05 14:27:59 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41556