public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-9173] Fix small regression in Ada
@ 2023-02-14 12:42 Eric Botcazou
0 siblings, 0 replies; only message in thread
From: Eric Botcazou @ 2023-02-14 12:42 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:2155c14612ed63fc7e93d038f0a8fe01bb14fefb
commit r12-9173-g2155c14612ed63fc7e93d038f0a8fe01bb14fefb
Author: Eric Botcazou <ebotcazou@adacore.com>
Date: Tue Feb 14 13:33:08 2023 +0100
Fix small regression in Ada
gcc/
* gimplify.cc (gimplify_save_expr): Add missing guard.
gcc/testsuite/
* gnat.dg/shift2.adb: New test.
Diff:
---
gcc/gimplify.cc | 2 +-
gcc/testsuite/gnat.dg/shift2.adb | 8 ++++++++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/gcc/gimplify.cc b/gcc/gimplify.cc
index a3aa90262c5..a551c574a2d 100644
--- a/gcc/gimplify.cc
+++ b/gcc/gimplify.cc
@@ -6373,7 +6373,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:42 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:42 [gcc r12-9173] 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).