From: Gary Dismukes <[email protected]>

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.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 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 1f8d86eb631..e07d24c1565 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
-- 
2.53.0

Reply via email to