diff options
author | Tristan Gingold | 2015-07-17 08:35:04 +0200 |
---|---|---|
committer | Tristan Gingold | 2015-07-17 08:35:04 +0200 |
commit | 64fa65e1395bef4f05c51bc19d9a46d6003339ee (patch) | |
tree | 98537c3e9f945e85aaf116966a32b56a51d2dd39 /src | |
parent | db08111a55bff4fcee5f268b44e247e5332d1e69 (diff) | |
download | ghdl-64fa65e1395bef4f05c51bc19d9a46d6003339ee.tar.gz ghdl-64fa65e1395bef4f05c51bc19d9a46d6003339ee.tar.bz2 ghdl-64fa65e1395bef4f05c51bc19d9a46d6003339ee.zip |
Do not create a transient type for strings.
Diffstat (limited to 'src')
-rw-r--r-- | src/vhdl/translate/trans-chap7.adb | 9 | ||||
-rw-r--r-- | src/vhdl/translate/trans.ads | 10 |
2 files changed, 14 insertions, 5 deletions
diff --git a/src/vhdl/translate/trans-chap7.adb b/src/vhdl/translate/trans-chap7.adb index c11f930..a3ae289 100644 --- a/src/vhdl/translate/trans-chap7.adb +++ b/src/vhdl/translate/trans-chap7.adb @@ -41,8 +41,7 @@ package body Trans.Chap7 is procedure Copy_Range (Dest : Mnode; Src : Mnode); function Translate_Static_Implicit_Conv - (Expr : O_Cnode; Expr_Type : Iir; Res_Type : Iir) - return O_Cnode + (Expr : O_Cnode; Expr_Type : Iir; Res_Type : Iir) return O_Cnode is Expr_Info : Type_Info_Acc; Res_Info : Type_Info_Acc; @@ -226,7 +225,7 @@ package body Trans.Chap7 is List : O_Array_Aggr_List; Res : O_Cnode; begin - Chap3.Translate_Anonymous_Type_Definition (Aggr_Type, True); + Chap3.Translate_Anonymous_Type_Definition (Aggr_Type, False); Start_Array_Aggr (List, Get_Ortho_Type (Aggr_Type, Mode_Value)); Translate_Static_Aggregate_1 @@ -244,7 +243,7 @@ package body Trans.Chap7 is List : O_Array_Aggr_List; Res : O_Cnode; begin - Chap3.Translate_Anonymous_Type_Definition (Aggr_Type, True); + Chap3.Translate_Anonymous_Type_Definition (Aggr_Type, False); Start_Array_Aggr (List, Get_Ortho_Type (Aggr_Type, Mode_Value)); for I in Natural loop @@ -441,7 +440,7 @@ package body Trans.Chap7 is if Get_Constraint_State (Str_Type) = Fully_Constrained and then Get_Type_Staticness (Get_Index_Type (Str_Type, 0)) = Locally then - Chap3.Create_Array_Subtype (Str_Type, True); + Chap3.Create_Array_Subtype (Str_Type, False); case Get_Kind (Str) is when Iir_Kind_String_Literal8 => Res := Translate_Static_String_Literal8 (Str); diff --git a/src/vhdl/translate/trans.ads b/src/vhdl/translate/trans.ads index 4e778de..8cf76b7 100644 --- a/src/vhdl/translate/trans.ads +++ b/src/vhdl/translate/trans.ads @@ -1675,6 +1675,16 @@ package Trans is -- FIXME: maybe a flag must be added to CLOSE_TEMP where it is known -- stack2 can be released. procedure Create_Temp_Stack2_Mark; + + -- Some constructs (slices, aggregates) implicitly define a subtype. + -- This subtype (and its bounds) is created dynamically and its life + -- is short. + -- However, in some cases (default expression, target of signal + -- assignment) the construct may be evaluated several time (eg: to + -- compute the drivers). In that case, bounds are created many times + -- and therefore must be forgotten at the end of its life to avoid any + -- incorrect reuse. + -- -- Add ATYPE in the chain of types to be destroyed at the end of the -- temp scope. procedure Add_Transient_Type_In_Temp (Atype : Iir); |