From patchwork Tue Jul 3 08:59:26 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 168742 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id F38882C0101 for ; Tue, 3 Jul 2012 19:09:01 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1341911342; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:From:To:Subject:Date:User-Agent:MIME-Version: Content-Type:Message-Id:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=UVr2nxk6D3Gb/T901105zzefNY4=; b=WsUluoT0/LhItrQ XQ0+NrmlPHxhIlT44ipizUKuZBeg/c4UAbjNttfWXxJAedBo7VC2P8dGSkRZZTqn ikAFQ7NqYT4xGmMXxGtrv3TaP4tMtKhth2xVd2+9c2RLismt5IVtYPT/xRXW5gWa M6Ag+hLmNBsS25A3KEsP+Nvrt1lk= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:From:To:Subject:Date:User-Agent:MIME-Version:Content-Type:Message-Id:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=dK3CU6QlmHO9tE4i803lQo8h/4LLDup+DNJcv2iMq7xi2/LMy0G5VGLoRfePLs 4yvXPsViGQvesCdljixCZ6u1TGqPwhm45+7D/4AzGWxEQoOiu7rhyvK7gW9TaH/b AIGyEW/Des81JF7JSqmCoFhIDBhn3FrnbieCwg2qg5hBI=; Received: (qmail 12349 invoked by alias); 3 Jul 2012 09:08:47 -0000 Received: (qmail 12324 invoked by uid 22791); 3 Jul 2012 09:08:44 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from mel.act-europe.fr (HELO mel.act-europe.fr) (194.98.77.210) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 03 Jul 2012 09:08:30 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 2EB3B29004A for ; Tue, 3 Jul 2012 11:08:35 +0200 (CEST) Received: from mel.act-europe.fr ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id L5Oj54k2G7ct for ; Tue, 3 Jul 2012 11:08:35 +0200 (CEST) Received: from [192.168.1.2] (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mel.act-europe.fr (Postfix) with ESMTP id D555D290049 for ; Tue, 3 Jul 2012 11:08:34 +0200 (CEST) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [Ada] Fix crash on recursive call to function with Out parameter Date: Tue, 3 Jul 2012 10:59:26 +0200 User-Agent: KMail/1.9.9 MIME-Version: 1.0 Message-Id: <201207031059.26348.ebotcazou@adacore.com> Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org The compiler crashes on the recursive call to a function with an In-Out or Out parameter passed by copy, in Ada 2012 mode. Tested on i586-suse-linux, applied on mainline and 4.7 branch. 2012-07-03 Eric Botcazou * gcc-interface/trans.c (Call_to_gnu): Robustify test for function case if the CICO mechanism is used. 2012-07-03 Eric Botcazou * gnat.dg/recursive_call.adb: New test. Index: gcc-interface/trans.c =================================================================== --- gcc-interface/trans.c (revision 189199) +++ gcc-interface/trans.c (working copy) @@ -4084,7 +4084,7 @@ Call_to_gnu (Node_Id gnat_node, tree *gn /* The first entry is for the actual return value if this is a function, so skip it. */ - if (TREE_VALUE (gnu_cico_list) == void_type_node) + if (function_call) gnu_cico_list = TREE_CHAIN (gnu_cico_list); if (Nkind (Name (gnat_node)) == N_Explicit_Dereference) @@ -4188,8 +4188,7 @@ Call_to_gnu (Node_Id gnat_node, tree *gn return value from it and update the return type. */ if (TYPE_CI_CO_LIST (gnu_subprog_type)) { - tree gnu_elmt = value_member (void_type_node, - TYPE_CI_CO_LIST (gnu_subprog_type)); + tree gnu_elmt = TYPE_CI_CO_LIST (gnu_subprog_type); gnu_call = build_component_ref (gnu_call, NULL_TREE, TREE_PURPOSE (gnu_elmt), false); gnu_result_type = TREE_TYPE (gnu_call);