diff options
author | Tristan Gingold <tgingold@free.fr> | 2022-08-12 06:00:54 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2022-08-12 06:00:54 +0200 |
commit | a4e0f0d85f3cada259499ab9315981eb3dae0b18 (patch) | |
tree | adc0246de5e5d9a2e28f6b2a954b31f6044c4288 /src/vhdl | |
parent | f6968a23424563d08494347bfab6d9b5ef9a2d55 (diff) | |
download | ghdl-a4e0f0d85f3cada259499ab9315981eb3dae0b18.tar.gz ghdl-a4e0f0d85f3cada259499ab9315981eb3dae0b18.tar.bz2 ghdl-a4e0f0d85f3cada259499ab9315981eb3dae0b18.zip |
trans-chap3: fix invalid copy of element layout. For #2166
Build element layout of a subtype if the element was defined by the subtype.
Diffstat (limited to 'src/vhdl')
-rw-r--r-- | src/vhdl/translate/trans-chap3.adb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/vhdl/translate/trans-chap3.adb b/src/vhdl/translate/trans-chap3.adb index 627ae2532..12784d897 100644 --- a/src/vhdl/translate/trans-chap3.adb +++ b/src/vhdl/translate/trans-chap3.adb @@ -752,8 +752,10 @@ package body Trans.Chap3 is -- Fully unconstrained, so there is no layout variable -- for it. null; - elsif Get_Array_Element_Constraint (Def) = Null_Iir then - -- No new constraints. + elsif El_Tinfo.S.Subtype_Owner /= Tinfo then + -- The element is not owned by this subtype, so it has + -- its own layout variable that must have been set. + -- Just copy the layout. Gen_Memcpy (M2Addr (Array_Bounds_To_Element_Layout (Targ, Def)), M2Addr (Get_Composite_Type_Layout (El_Tinfo)), |