[COMMITTED] ada: Small improvement to Null_Status function

Message ID 20231121100034.1964554-1-poulhies@adacore.com
State Committed
Commit 5ee80f712883981fde26976bb4f9e157e105944c
Headers
Series [COMMITTED] ada: Small improvement to Null_Status function |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gcc_build--master-arm warning Patch is already merged
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 warning Patch is already merged

Commit Message

Marc Poulhiès Nov. 21, 2023, 10 a.m. UTC
  From: Eric Botcazou <ebotcazou@adacore.com>

The function is used to optimize away access checks.

gcc/ada/

	* sem_util.adb (Null_Status): Deal with unchecked type conversions.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/sem_util.adb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Patch

diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index 3d870b1049c..eb2d83a4d6d 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -25429,7 +25429,7 @@  package body Sem_Util is
 
       --  Check the status of the operand of a type conversion
 
-      elsif Nkind (N) = N_Type_Conversion then
+      elsif Nkind (N) in N_Type_Conversion | N_Unchecked_Type_Conversion then
          return Null_Status (Expression (N));
 
       --  The input denotes a reference to an entity. Determine whether the