From patchwork Wed Sep 18 10:25:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 275663 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]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id B8D222C00E1 for ; Wed, 18 Sep 2013 20:26:28 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=ujLtORF8LV0vjQvZ naBg3tawW+KgQGeoFy/tGR6BD5BVIWCsGwR1fPP7ioskYOgi/imLs8D9jaAolsxH FuNKfUe9Mkqk+6GaFKOa6tHFCSupbUDS303JSI48Lb5HiEe8vkhcLrb7sYtEO1zh LYX6mHQXMxxWJt3bX4lNLqPhldk= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=UGXMW9VZ/KdiTdG1M7hhU4 0Qfo8=; b=vr+7zjRQhQaWyqWvsF/58SVe9b9BkqpVzXyaepKR2/jKCtDR2aACsN 8dlA80PUSbHKxBcX/hGsmIFSkq8n5k1hfL3Yz0yjzxSDM3GtRp4TecuSGEsngN1E IF+OYQwnHFRunmzr+dOfG2ec4P98uuIRZdY46Oh5Mut2os78513yw= Received: (qmail 21018 invoked by alias); 18 Sep 2013 10:26:22 -0000 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 Received: (qmail 21003 invoked by uid 89); 18 Sep 2013 10:26:21 -0000 Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Wed, 18 Sep 2013 10:26:21 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.8 required=5.0 tests=ALL_TRUSTED, AWL, BAYES_00 autolearn=ham version=3.3.2 X-HELO: smtp.eu.adacore.com Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id DE18B2682510 for ; Wed, 18 Sep 2013 12:26:17 +0200 (CEST) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id JGnPwqIMl9hN for ; Wed, 18 Sep 2013 12:26:17 +0200 (CEST) Received: from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id BC7862681E48 for ; Wed, 18 Sep 2013 12:26:17 +0200 (CEST) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [Ada] Fix bogus return value for function with In Out parameter Date: Wed, 18 Sep 2013 12:25:45 +0200 Message-ID: <3250168.2U2VWOoQtk@polaris> User-Agent: KMail/4.7.2 (Linux/3.1.10-1.29-desktop; KDE/4.7.2; x86_64; ; ) MIME-Version: 1.0 This fixes an oversight in the recent implementation of functions with In Out parameters for Ada 2012, which leads to wrong code if the function contains a nested subprogram which also takes an In Out parameter with elementary type. Tested on x86_64-suse-linux, applied on all active branches. 2013-09-18 Eric Botcazou * gcc-interface/trans.c (Subprogram_Body_to_gnu): Pop the stack of return variables for subprograms using the CICO mechanism. 2013-09-18 Eric Botcazou * gnat.dg/in_out_parameter4.adb: New test. Index: gcc-interface/trans.c =================================================================== --- gcc-interface/trans.c (revision 202681) +++ gcc-interface/trans.c (working copy) @@ -3605,6 +3605,8 @@ Subprogram_Body_to_gnu (Node_Id gnat_nod { tree gnu_retval; + gnu_return_var_stack->pop (); + add_stmt (gnu_result); add_stmt (build1 (LABEL_EXPR, void_type_node, gnu_return_label_stack->last ()));