From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25107 invoked by alias); 6 Jan 2012 16:29:32 -0000 Received: (qmail 25088 invoked by uid 22791); 6 Jan 2012 16:29:30 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 06 Jan 2012 16:29:07 +0000 From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/46328] [OOP] type-bound operator call with non-trivial polymorphic operand Date: Fri, 06 Jan 2012 16:29:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: burnus at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Status Resolution Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 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: 2012-01/txt/msg00669.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46328 Tobias Burnus changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |NEW Resolution|FIXED | --- Comment #10 from Tobias Burnus 2012-01-06 16:29:03 UTC --- REOPEN. The issue is mostly fixed (i.e. polymorphic operators work), but not completely. As Dominique pointed out [1], the parentheses in u = (u)*2. still confuse gfortran (it works without). Some preliminary analysis what goes wrong is available at [2, 3]: a) In gfc_build_class_symbol, the attr->class_ok does not propagate to fclass->attr.class_ok (should it?) b) In matching_typebound_op, checking an EXPR_OP with gfc_expr_attr (base->expr).class_ok fails - should on use base->expr->ts->u.derived->attr.class_ok ? c) In get_declared_from_expr (called by resolve_typebound_function): The following is wrong (ice - segfault) for an EXPR_OP: if (declared == NULL) declared = e->symtree->n.sym->ts.u.derived; should one use e->ts.u.derived? (Regarding (base->expr,e)->ts.u.derived: I vaguely recall that sometimes e->ts did not have the proper data and only e->symtree->n.sym->ts had. I don't recall the details and it might have been only needed with some draft patch. It might be that e->ts.u.derived was NULL, but it could have been also something different.) [1] http://gcc.gnu.org/ml/fortran/2012-01/msg00045.html [2] http://gcc.gnu.org/ml/fortran/2012-01/msg00049.html [3] http://gcc.gnu.org/ml/fortran/2012-01/msg00050.html