https://gcc.gnu.org/g:04d7a0e93946988bbaee5ead468df7b8ce3223ed

commit r16-1862-g04d7a0e93946988bbaee5ead468df7b8ce3223ed
Author: Piotr Trojanek <troja...@adacore.com>
Date:   Fri May 9 17:31:39 2025 +0200

    ada: Move aspects when instantiating subprograms as compilation units
    
    When rewriting N_Subprogram_Instantiation into wrapper packages we must move
    the original aspect specifications to the wrapper packages, as otherwise 
they
    will be only accessible via Original_Node. This is similar to how we move
    aspect specifications for expression functions and many other constructs.
    
    gcc/ada/ChangeLog:
    
            * sem_ch12.adb (Analyze_Subprogram_Instantiation): Move aspects when
            instantiating subprogram as a library unit.

Diff:
---
 gcc/ada/sem_ch12.adb | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb
index 062251f15a99..f492b2368575 100644
--- a/gcc/ada/sem_ch12.adb
+++ b/gcc/ada/sem_ch12.adb
@@ -6704,6 +6704,7 @@ package body Sem_Ch12 is
 
             elsif Nkind (Parent (N)) = N_Compilation_Unit then
                Rewrite (N, Unit (Parent (N)));
+               Move_Aspects (From => Original_Node (N), To => N);
                Set_Unit (Parent (N), N);
             end if;
 
@@ -6712,6 +6713,7 @@ package body Sem_Ch12 is
 
          elsif Nkind (Parent (N)) = N_Compilation_Unit then
             Rewrite (N, Unit (Parent (N)));
+            Move_Aspects (From => Original_Node (N), To => N);
             Set_Unit (Parent (N), N);
          end if;

Reply via email to