From: Piotr Trojanek <troja...@adacore.com>

This patch both makes GNAT emit warnings on unused assignments where previously
they were suppressed for obscure reasons and synchronizes routine
Get_Enclosing_Object with a similar routine in GNATprove (which differs in
handling of explicit dereferences).

gcc/ada/ChangeLog:

        * sem_util.adb (Get_Enclosing_Object): Traverse unchecked type
        conversions since they from the compiler and should be transparent for
        semantic reasoning.

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

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

diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index 3c2a776ce36..127728ab601 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -10314,7 +10314,9 @@ package body Sem_Util is
             =>
                return Get_Enclosing_Object (Prefix (N));
 
-            when N_Type_Conversion =>
+            when N_Type_Conversion
+               | N_Unchecked_Type_Conversion
+            =>
                return Get_Enclosing_Object (Expression (N));
 
             when others =>
-- 
2.43.0

Reply via email to