]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Ignore unchecked type conversions while getting enclosing object
authorPiotr Trojanek <trojanek@adacore.com>
Thu, 24 Apr 2025 14:56:20 +0000 (16:56 +0200)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Mon, 30 Jun 2025 13:47:22 +0000 (15:47 +0200)
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.

gcc/ada/sem_util.adb

index 3c2a776ce369244a4c407c37d15541b110883c56..127728ab601a53e6f07c0a0b6d2e287111d3098c 100644 (file)
@@ -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 =>