{"id":809995,"url":"http://patchwork.ozlabs.org/api/patches/809995/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/patch/3177176.qjaT7YMUt0@polaris/","project":{"id":17,"url":"http://patchwork.ozlabs.org/api/projects/17/?format=json","name":"GNU Compiler Collection","link_name":"gcc","list_id":"gcc-patches.gcc.gnu.org","list_email":"gcc-patches@gcc.gnu.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<3177176.qjaT7YMUt0@polaris>","list_archive_url":null,"date":"2017-09-05T08:29:47","name":"[Ada] Do not generate useless temporary for allocator","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"82f18e2afa9855dcf3e799e52e1d07877524f65f","submitter":{"id":4365,"url":"http://patchwork.ozlabs.org/api/people/4365/?format=json","name":"Eric Botcazou","email":"ebotcazou@adacore.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/gcc/patch/3177176.qjaT7YMUt0@polaris/mbox/","series":[{"id":1510,"url":"http://patchwork.ozlabs.org/api/series/1510/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/list/?series=1510","date":"2017-09-05T08:29:47","name":"[Ada] Do not generate useless temporary for allocator","version":1,"mbox":"http://patchwork.ozlabs.org/series/1510/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/809995/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/809995/checks/","tags":{},"related":[],"headers":{"Return-Path":"<gcc-patches-return-461457-incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","mailing list gcc-patches@gcc.gnu.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-461457-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"R26RqMR3\"; dkim-atps=neutral","sourceware.org; auth=none"],"Received":["from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xmg1n2pyKz9s7f\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue,  5 Sep 2017 18:32:12 +1000 (AEST)","(qmail 39642 invoked by alias); 5 Sep 2017 08:31:31 -0000","(qmail 34551 invoked by uid 89); 5 Sep 2017 08:29:55 -0000","from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210)\n\tby sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with\n\tESMTP; Tue, 05 Sep 2017 08:29:50 +0000","from localhost (localhost [127.0.0.1])\tby\n\tfiltered-smtp.eu.adacore.com (Postfix) with ESMTP id\n\t3585682310\tfor <gcc-patches@gcc.gnu.org>;\n\tTue,  5 Sep 2017 10:29:48 +0200 (CEST)","from smtp.eu.adacore.com ([127.0.0.1])\tby localhost\n\t(smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port\n\t10024)\twith ESMTP id I9sXnQl_jEf4 for <gcc-patches@gcc.gnu.org>;\n\tTue,  5 Sep 2017 10:29:48 +0200 (CEST)","from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net\n\t[88.161.99.133])\t(using TLSv1.2 with cipher\n\tECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\t(No client\n\tcertificate requested)\tby smtp.eu.adacore.com (Postfix) with\n\tESMTPSA id 0F99C82293\tfor <gcc-patches@gcc.gnu.org>;\n\tTue,  5 Sep 2017 10:29:48 +0200 (CEST)"],"DomainKey-Signature":"a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:from\n\t:to:subject:date:message-id:mime-version:content-type\n\t:content-transfer-encoding; q=dns; s=default; b=HI+ozIacSb0SFc8t\n\tLilbL+gM5nGiMPmSAUM1Vvkz8ffJbqPIUGo9vWlO9LK+6vlzYKCiVmHcRaNZ5ds6\n\t5jsQwZM/BoFB2WsOWxTX46V9cIUW7tIbWyAue2pC8flsjZgNO6A0ODDIWp7oQBLd\n\tJvTiTU74vxnFBu8BdynzgCCCc4s=","DKIM-Signature":"v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:from\n\t:to:subject:date:message-id:mime-version:content-type\n\t:content-transfer-encoding; s=default; bh=5WeJxkJq5ZBTjrDkmlix1F\n\t5obYU=; b=R26RqMR3NIpPpD2enxesOGvXOSr000gKcVx/Y32WwYC6ycf7qZwhlV\n\tSzZaSuGxoKET096hrWmu9uKSQrqkG/fj+VtwygfaToyEGixXPVJVukJTujgKza2O\n\t33jpVpj2+dgdhmcvyI/OJRscKlQpel8kVVqM0CIubECJuxfzivUG8=","Mailing-List":"contact gcc-patches-help@gcc.gnu.org; run by ezmlm","Precedence":"bulk","List-Id":"<gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>","List-Archive":"<http://gcc.gnu.org/ml/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-help@gcc.gnu.org>","Sender":"gcc-patches-owner@gcc.gnu.org","X-Virus-Found":"No","X-Spam-SWARE-Status":"No, score=-10.9 required=5.0 tests=AWL, BAYES_00,\n\tGIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE,\n\tSPF_PASS autolearn=ham version=3.3.2 spammy=","X-HELO":"smtp.eu.adacore.com","From":"Eric Botcazou <ebotcazou@adacore.com>","To":"gcc-patches@gcc.gnu.org","Subject":"[Ada] Do not generate useless temporary for allocator","Date":"Tue, 05 Sep 2017 10:29:47 +0200","Message-ID":"<3177176.qjaT7YMUt0@polaris>","User-Agent":"KMail/4.14.10 (Linux/3.16.7-53-desktop; KDE/4.14.9; x86_64; ; )","MIME-Version":"1.0","Content-Type":"multipart/mixed; boundary=\"nextPart4025910.YADA8NGsPZ\"","Content-Transfer-Encoding":"7Bit"},"content":"This is a regression present on the mainline, 7 and 6 branches: the compiler \ngenerates an useless temporary for an allocator.\n\nTested on x86_64-suse-linux, applied on mainline, 7 and 6 branches.\n\n\n2017-09-05  Eric Botcazou  <ebotcazou@adacore.com>\n\n\t* gcc-interface/trans.c (Call_to_gnu): If this is a function call and\n\tthere is no target, do not create a temporary for the return value for\n\tan allocator either.","diff":"Index: gcc-interface/trans.c\n===================================================================\n--- gcc-interface/trans.c\t(revision 251691)\n+++ gcc-interface/trans.c\t(working copy)\n@@ -4338,11 +4338,11 @@ Call_to_gnu (Node_Id gnat_node, tree *gn\n \t  parameters.\n \n        2. There is no target and the call is made for neither an object nor a\n-\t  renaming declaration, nor a return statement, and the return type has\n-\t  variable size, because in this case the gimplifier cannot create the\n-\t  temporary, or more generally is simply an aggregate type, because the\n-\t  gimplifier would create the temporary in the outermost scope instead\n-\t  of locally.\n+\t  renaming declaration, nor a return statement, nor an allocator, and\n+\t  the return type has variable size because in this case the gimplifier\n+\t  cannot create the temporary, or more generally is simply an aggregate\n+\t  type, because the gimplifier would then create the temporary in the\n+\t  outermost scope instead of locally.\n \n        3. There is a target and it is a slice or an array with fixed size,\n \t  and the return type has variable size, because the gimplifier\n@@ -4361,6 +4361,8 @@ Call_to_gnu (Node_Id gnat_node, tree *gn\n \t      && Nkind (Parent (gnat_node)) != N_Object_Declaration\n \t      && Nkind (Parent (gnat_node)) != N_Object_Renaming_Declaration\n \t      && Nkind (Parent (gnat_node)) != N_Simple_Return_Statement\n+\t      && !(Nkind (Parent (gnat_node)) == N_Qualified_Expression\n+\t\t   && Nkind (Parent (Parent (gnat_node))) == N_Allocator)\n \t      && AGGREGATE_TYPE_P (gnu_result_type)\n \t      && !TYPE_IS_FAT_POINTER_P (gnu_result_type))\n \t  || (gnu_target\n","prefixes":["Ada"]}