https://gcc.gnu.org/g:280e68a6d3fd5045e6c1b1f6937f00c81333a307

commit r17-1198-g280e68a6d3fd5045e6c1b1f6937f00c81333a307
Author: Gary Dismukes <[email protected]>
Date:   Fri Apr 17 23:15:29 2026 +0000

    ada: Linker_Section not inherited by object from unconstrained parent 
subtype
    
    In the case of an object_declaration with a subtype_indication
    whose subtype_mark denotes an unconstrained parent subtype (like
    "type Unconstrained_String is new String") that itself specifies
    the Linker_Section aspect or pragma, the object is not being inherited
    from the type like it should be, and so will not be allocated in
    the section specified by the aspect or pragma.
    
    gcc/ada/ChangeLog:
    
            * sem_ch3.adb (Copy_Parent_Attributes): Inherit 
Linker_Section_Pragma.

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

diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index 1f8d86eb6315..e07d24c15651 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -5800,6 +5800,8 @@ package body Sem_Ch3 is
          Set_Treat_As_Volatile (Id, Treat_As_Volatile (T));
          Set_Is_Generic_Type (Id, Is_Generic_Type (Base_Type (T)));
          Set_Convention (Id, Convention (T));
+         Set_Linker_Section_Pragma
+           (Id, Linker_Section_Pragma (Base_Type (T)));
       end Copy_Parent_Attributes;
 
    --  Start of processing for Analyze_Subtype_Declaration

Reply via email to