From patchwork Tue Feb 14 12:42:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 56904 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2946391wrn; Tue, 14 Feb 2023 04:43:02 -0800 (PST) X-Google-Smtp-Source: AK7set9jDZjC9sogM2jnbhww5kPGXjde3hU1WBmIyhPQNuELER5wcFQDWl0PddC0BZCT1u/0b6Sz X-Received: by 2002:a50:d08c:0:b0:4ab:554:37e9 with SMTP id v12-20020a50d08c000000b004ab055437e9mr2089253edd.41.1676378581744; Tue, 14 Feb 2023 04:43:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676378581; cv=none; d=google.com; s=arc-20160816; b=XUayFFjCrWLtA/v4TJA3OYhsSNPNA8l2SSR0oUxg0W3tCBuO4NUETaF7oPVB6XlQWM QKEMdwrJOOWtZIrsH1Z9eTT+egQ0UfUqKIyYGFCp0EMiLVj+sEbehRLga8K3/YRg/r+l Iukx8jEQ8oRJN/T62huwsrEar+z4ukPsoD6Rv6Ldt/ftcfr/hV76c7zbaKgmZc3xXHg/ FqN5L5qKqixwFp23triG06ly8/uOhG8LWDGruynkJY/D6B/W/rWIycotX2UW9eSi1XjK R8gRJ5RezfRMuUPUh/TuATmmmJJC0S06eWhTvUbHGcBjUVv67+k3YXBNUuRRBvDbjrSI 1lEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:to :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=f0Sl3YHe17yP9v4aYWUhcLamLTwegp80dxiVmNZHw9k=; b=DPTa2E/5YU/eETlYhKVqA88JgSec7Ut9BMiAuAeCx9YjBOa40MTEl0wI6izY+3fEKw ws50je67MRVvfKOSnHpy3XZ5nBr/B6Fg+3Mo+EFDkm/QpF8mqyb7XPN2MP21CCYj3wfO tDwGDuhNAgxHQRs6TRsrDqXpotrksbXIeyy4hc8aLpRcFIIlnIc7nKSZWVOpmV/Dw3tG DC6LOTZHDPw135iqQ2NRGPFmcgVkWlUGmyJ3GWjoJCNy90MvUPZVOyLEDCvSUIrqK8lE C+vOT62SW1TKaZjZWEYYKv1vzgUiwn1/AKBPquuw2R25qaPEfy5NZ8q7Z+uJQz7osjoJ ztBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=cSeuE5Oq; 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=gnu.org Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id p9-20020aa7cc89000000b0048ecc09a43csi15641735edt.343.2023.02.14.04.43.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Feb 2023 04:43:01 -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=@gcc.gnu.org header.s=default header.b=cSeuE5Oq; 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=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BC9B33858C53 for ; Tue, 14 Feb 2023 12:43:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BC9B33858C53 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1676378580; bh=f0Sl3YHe17yP9v4aYWUhcLamLTwegp80dxiVmNZHw9k=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=cSeuE5OqgkPqGtIqIuP7TwzHPtsEE4QV543LUHFA1S3+YTbcOE92n/fHw97ok8V2i tKr+lBXQX9lrI6W6FN2VZXLQVi7idKlMnwtZlfsrKNRO6Tnqo9CbhH6kfNdQ8mbnrW AQ89K452IF+pgUdLFBA2PGakNLyA/UfilfE3Gfik= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by sourceware.org (Postfix) with ESMTPS id A8C783858407 for ; Tue, 14 Feb 2023 12:42:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A8C783858407 Received: by mail-wr1-x429.google.com with SMTP id o18so15519460wrj.3 for ; Tue, 14 Feb 2023 04:42:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=f0Sl3YHe17yP9v4aYWUhcLamLTwegp80dxiVmNZHw9k=; b=6swbTBVKTdZpeQ4u03j3DGxm2B8/BZ2bGPWwoMu0YFFDuTX196zsFLM1KXHWEDn/XT 7tUmPdJb6z6WHJHgXb8bY3AL36suVvHTUk6xOUWzyrOQWkCkm+fFG/Rq5jbZA+upArby lvzrG+Hdzzcp1HkL2yMXRWVbackpEUVKH2L0Wfza29bHZrnueDx++B/Z3mUW46i/VJGZ 2/XlVieKu9HfYdBDh/D1vkNowagiTO6RFBvyahh1VM9dUH9Va9VD5yG72i4E+GIs0bew I0klERlvDqP3EWgLJVv8gxDPaR5HhYqZ62GRXeedtDHyWcm0bwjjKWWTaiDGt8eL8FHY HalQ== X-Gm-Message-State: AO0yUKUjKt/i8mJWe/QkPFr8Nw811dUqikOx1ksVeviamn3DNmG60SxD sDxE+LuiBhmNEvqf21NKZEwYHalx92wB5/gg X-Received: by 2002:a5d:6310:0:b0:2c4:459:48cb with SMTP id i16-20020a5d6310000000b002c4045948cbmr1934126wru.39.1676378535291; Tue, 14 Feb 2023 04:42:15 -0800 (PST) Received: from fomalhaut.localnet ([2a01:e0a:8d5:d990:e654:e8ff:fe8f:2ce6]) by smtp.gmail.com with ESMTPSA id l2-20020a5d6742000000b002c55cdb1de5sm3893611wrw.116.2023.02.14.04.42.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Feb 2023 04:42:14 -0800 (PST) X-Google-Original-From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix small regression in Ada Date: Tue, 14 Feb 2023 13:42:14 +0100 Message-ID: <3481520.iIbC2pHGDl@fomalhaut> MIME-Version: 1.0 X-Spam-Status: No, score=-10.6 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 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Eric Botcazou via Gcc-patches From: Eric Botcazou Reply-To: Eric Botcazou Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757810347696055081?= X-GMAIL-MSGID: =?utf-8?q?1757810347696055081?= It is present on the mainline and 12 branch and comes from Andrew P. and me forgetting about the VOID_TYPE_P case of SAVE_EXPRs. Tested on x86-64/Linux, applied on mainline and 12 branch as obvious. 2023-02-14 Eric Botcazou gcc/ * gimplify.cc (gimplify_save_expr): Add missing guard. gcc/ada/ * gcc-interface/trans.cc (gnat_gimplify_expr): Add missing guard. 2023-02-14 Eric Botcazou * gnat.dg/shift2.adb: New test. diff --git a/gcc/ada/gcc-interface/trans.cc b/gcc/ada/gcc-interface/trans.cc index 28e3867d142..5fc1a26fede 100644 --- a/gcc/ada/gcc-interface/trans.cc +++ b/gcc/ada/gcc-interface/trans.cc @@ -9049,7 +9049,9 @@ gnat_gimplify_expr (tree *expr_p, gimple_seq *pre_p, /* Propagate TREE_NO_WARNING from expression to temporary by using the SAVE_EXPR itself as an intermediate step. See gimplify_save_expr. */ - if (SAVE_EXPR_RESOLVED_P (expr)) + if (type == void_type_node) + ; + else if (SAVE_EXPR_RESOLVED_P (expr)) TREE_NO_WARNING (op) = TREE_NO_WARNING (expr); else TREE_NO_WARNING (expr) = TREE_NO_WARNING (op); diff --git a/gcc/gimplify.cc b/gcc/gimplify.cc index 1b362dd83e3..96845154a92 100644 --- a/gcc/gimplify.cc +++ b/gcc/gimplify.cc @@ -6441,7 +6441,7 @@ gimplify_save_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p) gcc_assert (TREE_CODE (*expr_p) == SAVE_EXPR); val = TREE_OPERAND (*expr_p, 0); - if (TREE_TYPE (val) == error_mark_node) + if (val && TREE_TYPE (val) == error_mark_node) return GS_ERROR; /* If the SAVE_EXPR has not been resolved, then evaluate it once. */