https://gcc.gnu.org/g:869acc9462b8c22e3a9c0b2d2ff287397fad704d

commit r16-9042-g869acc9462b8c22e3a9c0b2d2ff287397fad704d
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 6109d1e88c7f..d7cafddcb40e 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -5805,6 +5805,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