aboutsummaryrefslogtreecommitdiffstats
path: root/src/vhdl/vhdl-sem_types.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2021-03-21 16:19:20 +0100
committerTristan Gingold <tgingold@free.fr>2021-03-21 16:19:20 +0100
commit4bc549728f6b970060fe47c0b59f1c8f0fa6b459 (patch)
tree75bb2aacf37a70fb46b6bdd9276f662c7b18379e /src/vhdl/vhdl-sem_types.adb
parent7722e309ed51f5cfd69688f448a540224ba97014 (diff)
downloadghdl-4bc549728f6b970060fe47c0b59f1c8f0fa6b459.tar.gz
ghdl-4bc549728f6b970060fe47c0b59f1c8f0fa6b459.tar.bz2
ghdl-4bc549728f6b970060fe47c0b59f1c8f0fa6b459.zip
vhdl-sem_types: fix staticness of constrained array. For #1689
Diffstat (limited to 'src/vhdl/vhdl-sem_types.adb')
-rw-r--r--src/vhdl/vhdl-sem_types.adb17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/vhdl/vhdl-sem_types.adb b/src/vhdl/vhdl-sem_types.adb
index 9a68c1f1a..81a11e861 100644
--- a/src/vhdl/vhdl-sem_types.adb
+++ b/src/vhdl/vhdl-sem_types.adb
@@ -1685,11 +1685,10 @@ package body Vhdl.Sem_Types is
end Sem_Array_Constraint_Indexes;
-- DEF is an array_subtype_definition.
- procedure Sem_Array_Type_Constraint_Indexes (Def : Iir; Type_Mark : Iir)
+ procedure Sem_Array_Type_Constraint_Indexes
+ (Def : Iir; Type_Mark : Iir; Index_Staticness : out Iir_Staticness)
is
- El_Type : constant Iir := Get_Element_Subtype (Type_Mark);
Base_Type : constant Iir := Get_Base_Type (Type_Mark);
- Index_Staticness : Iir_Staticness;
begin
-- Check each index constraint against array type.
Set_Parent_Type (Def, Type_Mark);
@@ -1697,13 +1696,11 @@ package body Vhdl.Sem_Types is
Sem_Array_Constraint_Indexes
(Def, Type_Mark, Base_Type, Index_Staticness);
- Set_Type_Staticness
- (Def, Min (Get_Type_Staticness (El_Type), Index_Staticness));
Set_Signal_Type_Flag (Def, Get_Signal_Type_Flag (Type_Mark));
end Sem_Array_Type_Constraint_Indexes;
-- DEF is an incomplete subtype_indication or array_constraint,
- -- TYPE_MARK is the base type of the subtype_indication.
+ -- TYPE_MARK is an array type or subtype.
function Sem_Array_Constraint
(Def : Iir; Type_Mark : Iir; Resolution : Iir) return Iir
is
@@ -1713,6 +1710,7 @@ package body Vhdl.Sem_Types is
Resolv_Func : Iir := Null_Iir;
Resolv_El : Iir := Null_Iir;
Resolv_Ind : Iir;
+ Index_Staticness : Iir_Staticness;
begin
if Resolution /= Null_Iir then
-- A resolution indication is present.
@@ -1758,13 +1756,16 @@ package body Vhdl.Sem_Types is
return Res;
end if;
+ Index_Staticness := None;
+
-- No element constraint.
El_Def := Null_Iir;
when Iir_Kind_Array_Subtype_Definition =>
-- Case of a constraint for an array.
El_Def := Get_Array_Element_Constraint (Def);
- Sem_Array_Type_Constraint_Indexes (Def, Type_Mark);
+ Sem_Array_Type_Constraint_Indexes
+ (Def, Type_Mark, Index_Staticness);
Res := Def;
when others =>
@@ -1801,6 +1802,8 @@ package body Vhdl.Sem_Types is
Set_Element_Subtype (Res, El_Def);
Set_Constraint_State (Res, Get_Array_Constraint (Res));
+ Set_Type_Staticness
+ (Res, Min (Get_Type_Staticness (El_Def), Index_Staticness));
if Resolv_Func /= Null_Iir then
Sem_Resolution_Function (Resolv_Func, Res);