diff options
author | Tristan Gingold <tgingold@free.fr> | 2020-01-02 18:21:26 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2020-01-02 18:21:26 +0100 |
commit | 91faff646998925a81d57f8d5a6e1c5fcf1f7ce8 (patch) | |
tree | e48fbd106f2f9d224973242a9bb3a5966bc4de3f /src/vhdl/translate | |
parent | 46f881b0ad6a674bdb92ca8549ac71f4b8f9b6a4 (diff) | |
download | ghdl-91faff646998925a81d57f8d5a6e1c5fcf1f7ce8.tar.gz ghdl-91faff646998925a81d57f8d5a6e1c5fcf1f7ce8.tar.bz2 ghdl-91faff646998925a81d57f8d5a6e1c5fcf1f7ce8.zip |
vhdl: handle untranslated subtypes for record aggregates. Fix #1051
Diffstat (limited to 'src/vhdl/translate')
-rw-r--r-- | src/vhdl/translate/trans-chap7.adb | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/vhdl/translate/trans-chap7.adb b/src/vhdl/translate/trans-chap7.adb index cf94655e3..51f97e8e7 100644 --- a/src/vhdl/translate/trans-chap7.adb +++ b/src/vhdl/translate/trans-chap7.adb @@ -3629,7 +3629,9 @@ package body Trans.Chap7 is -- There are corresponding bounds. Expr := Get_Associated_Expr (Assoc); Expr_Type := Get_Type (Expr); - if Get_Constraint_State (Expr_Type) = Fully_Constrained then + if False + and then Get_Constraint_State (Expr_Type) = Fully_Constrained + then -- Translate subtype, and copy bounds. raise Internal_Error; else @@ -4174,14 +4176,15 @@ package body Trans.Chap7 is return Mnode is Res_Type : Iir; + Res : O_Enode; begin if Rtype = Null_Iir then Res_Type := Get_Type (Expr); else Res_Type := Rtype; end if; - return E2M (Translate_Expression (Expr, Res_Type), - Get_Info (Res_Type), Mode_Value); + Res := Translate_Expression (Expr, Res_Type); + return E2M (Res, Get_Info (Res_Type), Mode_Value); end Translate_Expression; function Translate_Expression (Expr : Iir; Rtype : Iir := Null_Iir) @@ -4249,6 +4252,12 @@ package body Trans.Chap7 is if Get_Constraint_State (Aggr_Type) /= Fully_Constrained then Tinfo := Get_Info (Aggr_Type); + if Tinfo = null then + -- AGGR_TYPE may be a subtype that has not been + -- translated. Use the base type in that case. + Aggr_Type := Get_Base_Type (Aggr_Type); + Tinfo := Get_Info (Aggr_Type); + end if; Mres := Create_Temp (Tinfo); Bounds := Create_Temp_Bounds (Tinfo); |