From patchwork Mon May 27 11:44:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 1105780 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-501718-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="NAsYNjeV"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45CFWW4LK0z9sB8 for ; Mon, 27 May 2019 21:44:37 +1000 (AEST) 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=scX40tFpQeR+ndaV Go8WHsj3LAi+R8ii5/LbvZIlRy7BOMhw9/D21DZctQl5c4dsbT+1qo1asC3U6abo sFHPMhafecaA6D4bJ0Phhy98VCJrJ6cJlTJ6Lxc1C9t/hrpVfp+w6t05zRAOTL+W If8uq3AAawpaZ+lJ4hAkkJdbhXg= 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=gfaotXYyYjKjg7hx557I2g MIYIw=; b=NAsYNjeVpX8hcisrlH2/K8SBsDF73zU2Q0pr61lO9lbBkNHp318az3 rTVff3X+xqFy9ULU0acMgVnbjdftzTY9+YJw+Pb2SQsK4YGZLonl7CULeyTqXZKv 7B6F3NTtfJ9f2vbgcAfcpTGlkCVz0hMDn1PSwU0xJYQd3OwQNV9Dk= Received: (qmail 108551 invoked by alias); 27 May 2019 11:44:31 -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 108543 invoked by uid 89); 27 May 2019 11:44:30 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-6.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=holding X-HELO: smtp.eu.adacore.com 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 ESMTP; Mon, 27 May 2019 11:44:29 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 797F08137F for ; Mon, 27 May 2019 13:44:27 +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 Diw7_EtfD8in for ; Mon, 27 May 2019 13:44:27 +0200 (CEST) Received: from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id 5A7D181354 for ; Mon, 27 May 2019 13:44:27 +0200 (CEST) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [Ada] Silence useless -Wuninitialized warning Date: Mon, 27 May 2019 13:44:26 +0200 Message-ID: <1750736.742D92u1z0@polaris> MIME-Version: 1.0 This silences a warning issued for the call to the initialization procedure of a record type on a misaligned component of another record type. Tested on x86_64-suse-linux, applied on the mainline and 9 branch. 2019-05-27 Eric Botcazou * gcc-interface/trans.c (Call_to_gnu): Do not initialize the temporary created out of addressability concerns if it's for the _Init parameter of an initialization procedure. Index: gcc-interface/trans.c =================================================================== --- gcc-interface/trans.c (revision 271658) +++ gcc-interface/trans.c (working copy) @@ -5313,13 +5313,23 @@ Call_to_gnu (Node_Id gnat_node, tree *gn /* Create an explicit temporary holding the copy. */ if (atomic_p) gnu_name = build_atomic_load (gnu_name, sync); - gnu_temp - = create_init_temporary ("A", gnu_name, &gnu_stmt, gnat_actual); - /* But initialize it on the fly like for an implicit temporary as - we aren't necessarily having a statement list. */ - gnu_name = build_compound_expr (TREE_TYPE (gnu_name), gnu_stmt, - gnu_temp); + /* Do not initialize it for the _Init parameter of an initialization + procedure since no data is meant to be passed in. */ + if (Ekind (gnat_formal) == E_Out_Parameter + && Is_Entity_Name (Name (gnat_node)) + && Is_Init_Proc (Entity (Name (gnat_node)))) + gnu_name = gnu_temp = create_temporary ("A", TREE_TYPE (gnu_name)); + + /* Initialize it on the fly like for an implicit temporary in the + other cases, as we don't necessarily have a statement list. */ + else + { + gnu_temp = create_init_temporary ("A", gnu_name, &gnu_stmt, + gnat_actual); + gnu_name = build_compound_expr (TREE_TYPE (gnu_name), gnu_stmt, + gnu_temp); + } /* Set up to move the copy back to the original if needed. */ if (!in_param)