aboutsummaryrefslogtreecommitdiffstats
path: root/src/vhdl
diff options
context:
space:
mode:
Diffstat (limited to 'src/vhdl')
-rw-r--r--src/vhdl/sem_names.adb18
-rw-r--r--src/vhdl/translate/trans-chap6.adb5
2 files changed, 14 insertions, 9 deletions
diff --git a/src/vhdl/sem_names.adb b/src/vhdl/sem_names.adb
index 0d03b8d4f..6e7315bb7 100644
--- a/src/vhdl/sem_names.adb
+++ b/src/vhdl/sem_names.adb
@@ -1898,27 +1898,31 @@ package body Sem_Names is
-- Analyze SUB_NAME.NAME as a selected element.
procedure Sem_As_Selected_Element (Sub_Name : Iir)
is
- Base_Type : Iir;
+ Name_Type : Iir;
Ptr_Type : Iir;
Rec_El : Iir;
R : Iir;
Se : Iir;
begin
-- FIXME: if not is_expr (sub_name) return.
- Base_Type := Get_Base_Type (Get_Type (Sub_Name));
- if Get_Kind (Base_Type) = Iir_Kind_Access_Type_Definition then
- Ptr_Type := Base_Type;
- Base_Type := Get_Base_Type (Get_Designated_Type (Base_Type));
+ Name_Type := Get_Type (Sub_Name);
+ if Kind_In (Name_Type, Iir_Kind_Access_Type_Definition,
+ Iir_Kind_Access_Subtype_Definition)
+ then
+ Ptr_Type := Name_Type;
+ Name_Type := Get_Designated_Type (Name_Type);
else
Ptr_Type := Null_Iir;
end if;
- if Get_Kind (Base_Type) /= Iir_Kind_Record_Type_Definition then
+ if not Kind_In (Name_Type, Iir_Kind_Record_Type_Definition,
+ Iir_Kind_Record_Subtype_Definition)
+ then
return;
end if;
Rec_El := Find_Name_In_List
- (Get_Elements_Declaration_List (Base_Type), Suffix);
+ (Get_Elements_Declaration_List (Name_Type), Suffix);
if Rec_El = Null_Iir then
return;
end if;
diff --git a/src/vhdl/translate/trans-chap6.adb b/src/vhdl/translate/trans-chap6.adb
index e9f2987dd..d1375c728 100644
--- a/src/vhdl/translate/trans-chap6.adb
+++ b/src/vhdl/translate/trans-chap6.adb
@@ -816,8 +816,9 @@ package body Trans.Chap6 is
function Translate_Selected_Element
(Prefix : Mnode; El : Iir_Element_Declaration) return Mnode
is
- El_Info : constant Field_Info_Acc := Get_Info (El);
- El_Type : constant Iir := Get_Type (El);
+ Base_El : constant Iir := Get_Base_Element_Declaration (El);
+ El_Info : constant Field_Info_Acc := Get_Info (Base_El);
+ El_Type : constant Iir := Get_Type (Base_El);
El_Tinfo : constant Type_Info_Acc := Get_Info (El_Type);
Kind : constant Object_Kind_Type := Get_Object_Kind (Prefix);
Stable_Prefix : Mnode;