]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Tweak Kill_Current_Values
authorRonan Desplanques <desplanques@adacore.com>
Thu, 27 Feb 2025 10:25:45 +0000 (11:25 +0100)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Mon, 9 Jun 2025 06:32:03 +0000 (08:32 +0200)
Is_Object returns True for "record field" entities, which might make
sense in some contexts but not when Kill_Current_Values is called in a
default expression of a record component. This patch refines the choice
of considered entities in Kill_Current_Values accordingly.

gcc/ada/ChangeLog:

* sem_util.adb (Kill_Current_Values): Tweak condition.

gcc/ada/sem_util.adb

index 0ce9e95a62060ba8a1718a9407bfc6bd599f1d8a..02ebb71b562c668d9a4bcae0bc23ea806ca39bcf 100644 (file)
@@ -21907,7 +21907,7 @@ package body Sem_Util is
          Set_Last_Assignment (Ent, Empty);
       end if;
 
-      if Is_Object (Ent) then
+      if Is_Object (Ent) and then Ekind (Ent) not in Record_Field_Kind then
          if not Last_Assignment_Only then
             Kill_Checks (Ent);
             Set_Current_Value (Ent, Empty);