From: Eric Botcazou <botcazou@adacore.com>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH] Fix small regression in Ada
Date: Tue, 14 Feb 2023 13:42:14 +0100 [thread overview]
Message-ID: <3481520.iIbC2pHGDl@fomalhaut> (raw)
[-- Attachment #1: Type: text/plain, Size: 498 bytes --]
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 <ebotcazou@adacore.com>
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 <ebotcazou@adacore.com>
* gnat.dg/shift2.adb: New test.
--
Eric Botcazou
[-- Attachment #2: p.diff --]
[-- Type: text/x-patch, Size: 1154 bytes --]
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. */
[-- Attachment #3: shift2.adb --]
[-- Type: text/x-adasrc, Size: 191 bytes --]
-- { dg-do compile }
with Interfaces; use Interfaces;
function Shift2 (V : Unsigned_32) return Unsigned_32 is
begin
return Shift_Left (V, (case V is when 0 => 1, when others => 0));
end;
reply other threads:[~2023-02-14 12:42 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3481520.iIbC2pHGDl@fomalhaut \
--to=botcazou@adacore.com \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).