[COMMITTED] ada: Handle unchecked conversion in bound

Message ID 20231128093842.2970706-1-poulhies@adacore.com
State Committed
Commit 89ed5455850437782358e0b3fb399bb5d4ec5f65
Headers
Series [COMMITTED] ada: Handle unchecked conversion in bound |

Checks

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

Commit Message

Marc Poulhiès Nov. 28, 2023, 9:38 a.m. UTC
  From: Richard Kenner <kenner@adacore.com>

Look through both unchecked and normal conversions when seeing if any
part of a bound is uplevel.

gcc/ada/

	* exp_unst.adb (Note_Uplevel_Bound): Treat
	N_Unchecked_Type_Conversion like N_Type_Conversion.

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

---
 gcc/ada/exp_unst.adb | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
  

Patch

diff --git a/gcc/ada/exp_unst.adb b/gcc/ada/exp_unst.adb
index b01cfc13bf9..7acb0656262 100644
--- a/gcc/ada/exp_unst.adb
+++ b/gcc/ada/exp_unst.adb
@@ -643,7 +643,9 @@  package body Exp_Unst is
 
                   --  Conversion case
 
-                  elsif Nkind (N) = N_Type_Conversion then
+                  elsif Nkind (N) in
+                          N_Type_Conversion | N_Unchecked_Type_Conversion
+                  then
                      Note_Uplevel_Bound (Expression (N), Ref);
                   end if;
                end Note_Uplevel_Bound;