From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1953 invoked by alias); 18 Dec 2014 22:07:19 -0000 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 Received: (qmail 1924 invoked by uid 48); 18 Dec 2014 22:07:14 -0000 From: "janus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/64209] [OOP] runtime segfault with CLASS(*), INTENT(OUT) dummy argument Date: Thu, 18 Dec 2014 22:07: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-Version: 5.0 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-Flags: X-Bugzilla-Changed-Fields: bug_status assigned_to Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-12/txt/msg02110.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64209 janus at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |janus at gcc dot gnu.org --- Comment #4 from janus at gcc dot gnu.org --- The following patch is sufficient to make the reduced test case in comment 2 work: Index: gcc/fortran/trans-expr.c =================================================================== --- gcc/fortran/trans-expr.c (Revision 218874) +++ gcc/fortran/trans-expr.c (Arbeitskopie) @@ -980,6 +980,9 @@ gfc_trans_class_init_assign (gfc_code *code) src.expr = gfc_build_addr_expr (NULL_TREE, src.expr); tmp = gfc_build_memcpy_call (dst.expr, src.expr, memsz.expr); + + tmp = build3_loc (input_location, COND_EXPR, TREE_TYPE (tmp), + src.expr, tmp, build_empty_stmt (input_location)); } if (code->expr1->symtree->n.sym->attr.optional However, the original test case in comment 0 still segfaults, so there seems to be yet another problem.