diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/synth/synth-vhdl_eval.adb | 2 | ||||
| -rw-r--r-- | src/synth/synth-vhdl_oper.adb | 3 | ||||
| -rw-r--r-- | src/synth/synth-vhdl_stmts.adb | 4 | 
3 files changed, 8 insertions, 1 deletions
diff --git a/src/synth/synth-vhdl_eval.adb b/src/synth/synth-vhdl_eval.adb index 78003539e..ddc9e7052 100644 --- a/src/synth/synth-vhdl_eval.adb +++ b/src/synth/synth-vhdl_eval.adb @@ -86,6 +86,8 @@ package body Synth.Vhdl_Eval is           return Prev;        end if; +      --  TODO: should be directly allocated on the expr_pool to avoid +      --  a copy.        return Create_Vec_Type_By_Length (Prev.W, Prev.Arr_El);     end Create_Res_Bound; diff --git a/src/synth/synth-vhdl_oper.adb b/src/synth/synth-vhdl_oper.adb index 22ef709aa..9063e84c4 100644 --- a/src/synth/synth-vhdl_oper.adb +++ b/src/synth/synth-vhdl_oper.adb @@ -2255,8 +2255,11 @@ package body Synth.Vhdl_Oper is                 Mt := Eval_Static_Predefined_Function_Call                   (Syn_Inst, Param1, Param2, Res_Typ, Expr); +                 if Mt /= Null_Memtyp then                    Res := Create_Value_Memtyp (Mt); +                  --  Protect deallocation. +                  Res.Typ := Unshare_Type_Expr (Res.Typ, Res_Typ);                 else                    Res := No_Valtyp;                 end if; diff --git a/src/synth/synth-vhdl_stmts.adb b/src/synth/synth-vhdl_stmts.adb index 1f2d308a4..6a9d0a348 100644 --- a/src/synth/synth-vhdl_stmts.adb +++ b/src/synth/synth-vhdl_stmts.adb @@ -2690,8 +2690,10 @@ package body Synth.Vhdl_Stmts is        Free_Instance (Sub_Inst);        if Res /= No_Valtyp then -         --  Protect return value from being deallocated +         --  Protect return value from being deallocated. +         --  The result can be a local variable.           Res := Unshare (Res, Expr_Pool'Access); +         --  The type can have been created in the function.           Ret_Typ := Get_Subtype_Object (Syn_Inst, Get_Type (Imp));           Res.Typ := Unshare_Type_Expr (Res.Typ, Ret_Typ);        end if;  | 
