From patchwork Tue Nov 7 09:20:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 162352 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:aa0b:0:b0:403:3b70:6f57 with SMTP id k11csp114765vqo; Tue, 7 Nov 2023 01:29:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IHT8Bj786e5v3RfU9RepCOqZebtiWOTNXusU16uuIsNmVt85vL/rwpwACBHLWPjfYJFjQN4 X-Received: by 2002:a05:622a:104c:b0:419:52a9:9ffb with SMTP id f12-20020a05622a104c00b0041952a99ffbmr39696050qte.20.1699349361963; Tue, 07 Nov 2023 01:29:21 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1699349361; cv=pass; d=google.com; s=arc-20160816; b=KbEY6xPrBa41uMCPpakALo9wyIOFGqR7zwsyrELXlid2vD2V6Cvq1HTEtWlJcEOW+7 IcdEBjLwQD5ObNXRvRf/BbA2W1i828R7ytgBb2MCyzumuHCdL4Os0dfee+sZ/4ulWnUi xoCUd/DHd/nonjV/04IzP5ZHjJ9uUsACaVx4vFKjkEwMEu4PdJM7xXDi6OWoFsPyk0gj m4PIegi5kOpTmlCahAY+660vMa0x+ccP+N0KszfD9JXeTWevdShACtz7tghjIpM7knrT cXvlAysPtRvik1x953IXN5osrt/Jm+OrOFXWjUKYiW1N4Y4HuYzN/OUQbJN5p++m54Pm I1TQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=Z+B0PZSYIZnbL/W6XUF9y/ioY1gZsagTiZJ6W5QCs3o=; fh=hOhsC1930eHatDPYd2EALQ9Ry/g++vvN4vxlQkRuX+0=; b=F/auaEL3RVr3HyAfzCAPSpQuSSs2jlE8glKM9cMN7StIggXyeGqTYWQdVVndtmCR04 V4RDoPGtmkNOIEf1P+Slq8mMucCtQ2vW3FPQKXdiI/PE3HFD7ZQRNgMDIL+b5uSrABLP FlNvgyiylo9PgCRyrVMT02q6JTzMCGp+F//7/kX3p1GJpGxsWj3KSQIlIp9WPABi/yQ2 c2ekyHTsd1mZ45mDeeonlsPpqbqyhyZb+jSZL1/mhuiqIZEthn7bGohkm5LsZYl+azmH 2a1y919zwCWqcW4QmVvjv1Z4Qq8+a1RVOz2XOah1QvND7L1ueGLvVlnMIc4odTXB+AEq fFwA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@adacore.com header.s=google header.b=RMrdL1Bg; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=adacore.com Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id p17-20020a05622a00d100b0041cbd6fe795si6478102qtw.22.2023.11.07.01.29.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 01:29:21 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@adacore.com header.s=google header.b=RMrdL1Bg; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=adacore.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AC20E385840E for ; Tue, 7 Nov 2023 09:29:21 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by sourceware.org (Postfix) with ESMTPS id A1B313858035 for ; Tue, 7 Nov 2023 09:20:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A1B313858035 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A1B313858035 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::42b ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699348856; cv=none; b=tBGF3kORZJ0JQh2au+DqPpFBBNuHlzHt4kqi6VWHq4Y5wo2OEv4gHpmSfZN+8sgAFp8WyxvKPX1giTcv00OrUIHsJOpGus/A0gSgkODCfOERx9az8KlrU370Zn/EhKeDmTU69/8OIg0/LXU5FCei4H/r5RBU+RYCLAil8yt2S/k= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699348856; c=relaxed/simple; bh=6CVQ9ghCTjK2njV/wlm6p8X8H815MzcD4IlMgC6r/xk=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=RHxe496uTn3dwzoClEbpwotCssEYtTJ/KseOeXD3lOeDmGyfK3PS8pv06UZigXWckhOZNwS6cZvtalr0bWG4fKETrr1a28FLEDsPo6hmj2xb8S0qIBpvxCOWHa8g7qnW9cRCnC37sa5i6yyC8bn8rIoLBz84/vZT1TegDA7IfwQ= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-32d895584f1so3210838f8f.1 for ; Tue, 07 Nov 2023 01:20:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1699348850; x=1699953650; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Z+B0PZSYIZnbL/W6XUF9y/ioY1gZsagTiZJ6W5QCs3o=; b=RMrdL1Bg2EKWv0fpfOgobAAF7oYTPHfkBZu9nzuUedUOFCDZefJ4VAwZr2fNFqCm2a ql6HSWO2sRVJlXcXh7vzt80NjJE2gaL+YyVfZywtNwykcyHFRrgAuf6O9fJ+RLqwXnC4 xJIZ7fHucLxyOk+uqCB85GUp1ijRHykS4H8/gAq11nRfgnQ6mXLgoIkQXR1Ifs3qrP66 CxiLQTZKhxHGrcvp+HiJhtNUo23MZai/GjQvGWcKcf3olMZZ8L6RhteTHNOrnoM/HgyV k6yKvGcp/OEPmi0TvUbCX/oFK4cR1kYZ6U57Y+AiNh58qb3gVKLkYJS5vYTQf5g4yhe/ HOfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699348850; x=1699953650; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Z+B0PZSYIZnbL/W6XUF9y/ioY1gZsagTiZJ6W5QCs3o=; b=ZbqF7OjHdgUCj1hx/lTi4N+zgO0piC1y8cUWTYDw5h6KveNIfCJ80r2pBsLOGszNKm zdrpbLvB61Sc+CeRHj8JRxBLjcIDtdqdDuHTETUpbwMaAFhOgObhCa5dico4zom2ppL+ xMQGqkmL2crYykPHS/+9ytKoHL4dxCks8DlpIxUZxF5kuDQ/jVQwQ3Hwj83YGgK/fq+2 OgHiAk3r9VxpA4kkddUxm79KOvf8vkMOopJFei7E9ll0OPfXk3wkNZQt5slQnkRKYnv/ IDGjoVac/NRiCw1nI1sMU5Ss4JASwifYygNxtwtiPYmy1+R/b4zjaIZj+1n3XJGcb5zL AkbA== X-Gm-Message-State: AOJu0Yz8M22Oje4C/gA3/ZodOyq4BpZ9YNASxgRnLvu/OF68ajqovWfX FYHzed75td3H2y1yWHjtwh3tyvZG3UrbXObYHNOMUQ== X-Received: by 2002:a05:6000:1547:b0:32f:88e8:b8d1 with SMTP id 7-20020a056000154700b0032f88e8b8d1mr21049728wry.13.1699348850448; Tue, 07 Nov 2023 01:20:50 -0800 (PST) Received: from localhost.localdomain ([2001:861:3382:1a90:dbc1:a1d1:2e58:4040]) by smtp.gmail.com with ESMTPSA id y18-20020a5d4ad2000000b00323287186aasm1808294wrs.32.2023.11.07.01.20.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 01:20:50 -0800 (PST) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [COMMITTED] ada: Fix spurious -Wstringop-overflow with link time optimization Date: Tue, 7 Nov 2023 10:20:47 +0100 Message-ID: <20231107092047.3907065-1-poulhies@adacore.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 X-Spam-Status: No, score=-13.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781896956716452427 X-GMAIL-MSGID: 1781896956716452427 From: Eric Botcazou It comes from an incomplete optimization performed by LTO that is caused by an obsolete transformation done in Gigi, which is redundant with the common uniquization of constant CONSTRUCTORs now performed during gimplification. gcc/ada/ * gcc-interface/trans.cc (gnat_gimplify_expr) : Delete. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/gcc-interface/trans.cc | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/gcc/ada/gcc-interface/trans.cc b/gcc/ada/gcc-interface/trans.cc index 89f0a07c824..c7d91628f80 100644 --- a/gcc/ada/gcc-interface/trans.cc +++ b/gcc/ada/gcc-interface/trans.cc @@ -8950,30 +8950,6 @@ gnat_gimplify_expr (tree *expr_p, gimple_seq *pre_p, } break; - case CALL_EXPR: - /* If we are passing a constant fat pointer CONSTRUCTOR, make sure it is - put into static memory; this performs a restricted version of constant - propagation on fat pointers in calls. But do not do it for strings to - avoid blocking concatenation in the caller when it is inlined. */ - for (int i = 0; i < call_expr_nargs (expr); i++) - { - tree arg = CALL_EXPR_ARG (expr, i); - - if (TREE_CODE (arg) == CONSTRUCTOR - && TREE_CONSTANT (arg) - && TYPE_IS_FAT_POINTER_P (TREE_TYPE (arg))) - { - tree t = CONSTRUCTOR_ELT (arg, 0)->value; - if (TREE_CODE (t) == NOP_EXPR) - t = TREE_OPERAND (t, 0); - if (TREE_CODE (t) == ADDR_EXPR) - t = TREE_OPERAND (t, 0); - if (TREE_CODE (t) != STRING_CST) - CALL_EXPR_ARG (expr, i) = tree_output_constant_def (arg); - } - } - break; - case DECL_EXPR: op = DECL_EXPR_DECL (expr);