public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-5985] Fix small regression in Ada
@ 2023-02-14 12:28 Eric Botcazou
0 siblings, 0 replies; only message in thread
From: Eric Botcazou @ 2023-02-14 12:28 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:1434eee54e57ad4839c0697f1294f9e8fe0a3044
commit r13-5985-g1434eee54e57ad4839c0697f1294f9e8fe0a3044
Author: Eric Botcazou <ebotcazou@adacore.com>
Date: Tue Feb 14 13:27:18 2023 +0100
Fix small regression in Ada
gcc/
* gimplify.cc (gimplify_save_expr): Add missing guard.
gcc/ada/
* gcc-interface/trans.cc (gnat_gimplify_expr): Add missing guard.
gcc/testsuite/
* gnat.dg/shift2.adb: New test.
Diff:
---
gcc/ada/gcc-interface/trans.cc | 4 +++-
gcc/gimplify.cc | 2 +-
gcc/testsuite/gnat.dg/shift2.adb | 8 ++++++++
3 files changed, 12 insertions(+), 2 deletions(-)
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. */
diff --git a/gcc/testsuite/gnat.dg/shift2.adb b/gcc/testsuite/gnat.dg/shift2.adb
new file mode 100644
index 00000000000..b45e4401813
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/shift2.adb
@@ -0,0 +1,8 @@
+-- { 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;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-02-14 12:28 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-14 12:28 [gcc r13-5985] Fix small regression in Ada Eric Botcazou
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).