From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11298 invoked by alias); 9 Feb 2013 15:53:13 -0000 Received: (qmail 11154 invoked by uid 48); 9 Feb 2013 15:52:56 -0000 From: "janus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/56261] [OOP] seg fault call procedure pointer on polymorphic array Date: Sat, 09 Feb 2013 15:53: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: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: janus at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: janus at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Status AssignedTo 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: 2013-02/txt/msg00905.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56261 janus at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED AssignedTo|unassigned at gcc dot |janus at gcc dot gnu.org |gnu.org | --- Comment #7 from janus at gcc dot gnu.org 2013-02-09 15:52:55 UTC --- Here is a patch which rejects comment 0 and 1: Index: gcc/fortran/interface.c =================================================================== --- gcc/fortran/interface.c (revision 195915) +++ gcc/fortran/interface.c (working copy) @@ -3202,6 +3202,13 @@ gfc_procedure_use (gfc_symbol *sym, gfc_actual_arg "at %L", &a->expr->where); return FAILURE; } + + if (a->expr && a->expr->ts.type == BT_CLASS) + { + gfc_error ("Polymorphic argument requires an explicit interface " + "at %L", &a->expr->where); + return FAILURE; + } } return SUCCESS; I think it's ok to throw an error (and not just a warning), because a polymorphic actual arg can only be passed to a polymorphic formal arg, which is invalid in connection with an implicit interface.