From 7cbd526468940a0146c7e89a1393f656d1de7c71 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Sat, 28 Jan 2023 20:10:28 +0100 Subject: vhdl-sem_decls: do not reassign type declarator on subtype aliases --- src/vhdl/vhdl-sem_decls.adb | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/vhdl/vhdl-sem_decls.adb b/src/vhdl/vhdl-sem_decls.adb index 47f77e917..32daadeb6 100644 --- a/src/vhdl/vhdl-sem_decls.adb +++ b/src/vhdl/vhdl-sem_decls.adb @@ -852,22 +852,28 @@ package body Vhdl.Sem_Decls is return; end if; - if not Is_Anonymous_Type_Definition (Def) - and then Get_Kind (Def) /= Iir_Kind_Protected_Type_Declaration - and then Get_Kind (Def) /= Iir_Kind_Interface_Type_Definition - then - -- There is no added constraints and therefore the subtype - -- declaration is in fact an alias of the type. Create a copy so - -- that it has its own type declarator. - -- (Except for protected types). - Def := Copy_Subtype_Indication (Def); - Location_Copy (Def, Decl); - Set_Subtype_Type_Mark (Def, Ind); - Set_Subtype_Indication (Decl, Def); + if not Is_Anonymous_Type_Definition (Def) then + if Get_Kind (Def) /= Iir_Kind_Protected_Type_Declaration + and then Get_Kind (Def) /= Iir_Kind_Interface_Type_Definition + then + -- There is no added constraints and therefore the subtype + -- declaration is in fact an alias of the type. Create a copy so + -- that it has its own type declarator. + -- (Except for protected types). + Def := Copy_Subtype_Indication (Def); + Location_Copy (Def, Decl); + Set_Subtype_Type_Mark (Def, Ind); + Set_Subtype_Indication (Decl, Def); + Set_Type_Declarator (Def, Decl); + else + -- Do not set type_declarator, as there is no copy. + null; + end if; + else + Set_Type_Declarator (Def, Decl); end if; Set_Type (Decl, Def); - Set_Type_Declarator (Def, Decl); Name_Visible (Decl); if Is_Global then Set_Type_Has_Signal (Def); -- cgit v1.2.3