diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/vhdl/vhdl-evaluation.ads | 3 | ||||
-rw-r--r-- | src/vhdl/vhdl-sem_expr.adb | 7 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/vhdl/vhdl-evaluation.ads b/src/vhdl/vhdl-evaluation.ads index 3b68e003d..1abd5aab6 100644 --- a/src/vhdl/vhdl-evaluation.ads +++ b/src/vhdl/vhdl-evaluation.ads @@ -191,6 +191,9 @@ package Vhdl.Evaluation is -- using the same format as SIMPLE_NAME attribute. function Eval_Simple_Name (Id : Name_Id) return String; + -- Convert aggregate or string literal to a simple agggregate. + function Eval_String_Literal (Str : Iir) return Iir; + -- Compare two string literals (of same length). type Compare_Type is (Compare_Lt, Compare_Eq, Compare_Gt); function Compare_String_Literals (L, R : Iir) return Compare_Type; diff --git a/src/vhdl/vhdl-sem_expr.adb b/src/vhdl/vhdl-sem_expr.adb index 4294e71c2..a801afdbe 100644 --- a/src/vhdl/vhdl-sem_expr.adb +++ b/src/vhdl/vhdl-sem_expr.adb @@ -2315,6 +2315,13 @@ package body Vhdl.Sem_Expr is return; end if; + -- If the choice is an aggregate (which could be static in vhdl08), + -- transform it into a simple aggregate to ease the comparisons. + if Get_Kind (Expr) = Iir_Kind_Aggregate then + Expr := Eval_String_Literal (Expr); + Set_Choice_Expression (Choice, Expr); + end if; + Choice_Len := Eval_Discrete_Type_Length (Get_String_Type_Bound_Type (Get_Type (Expr))); if Sel_Length = -1 then |