]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Fix bug in maintaining dimension info
authorSteve Baird <baird@adacore.com>
Thu, 15 Feb 2024 23:13:12 +0000 (15:13 -0800)
committerMarc Poulhiès <poulhies@adacore.com>
Thu, 16 May 2024 08:49:27 +0000 (10:49 +0200)
Copying a node does not automatically propagate its associated dimension
information (if any). This must be done explicitly.

gcc/ada/

* sem_util.adb (Copy_Node_With_Replacement): Add call to
Copy_Dimensions so that any dimension information associated with
the copied node is also associated with the resulting copy.

gcc/ada/sem_util.adb

index 1785931530f810c18fe90d03ba341f541950a2a8..68e131db60625e973647fb6891e85e9c76143bd8 100644 (file)
@@ -53,6 +53,7 @@ with Sem_Cat;        use Sem_Cat;
 with Sem_Ch6;        use Sem_Ch6;
 with Sem_Ch8;        use Sem_Ch8;
 with Sem_Ch13;       use Sem_Ch13;
+with Sem_Dim;        use Sem_Dim;
 with Sem_Disp;       use Sem_Disp;
 with Sem_Elab;       use Sem_Elab;
 with Sem_Eval;       use Sem_Eval;
@@ -23447,6 +23448,8 @@ package body Sem_Util is
                   Set_Chars (Result, Chars (Entity (Result)));
                end if;
             end if;
+
+            Copy_Dimensions (From => N, To => Result);
          end if;
 
          return Result;