From 93699fae475d20b02852fce787f80993c1640fd1 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Mon, 28 Sep 2020 07:40:23 +0200 Subject: vhdl-sem_expr: evaluate operands only if the operator result is not static. --- src/vhdl/vhdl-sem_expr.adb | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/vhdl/vhdl-sem_expr.adb b/src/vhdl/vhdl-sem_expr.adb index 4d6b772b5..e00aaadff 100644 --- a/src/vhdl/vhdl-sem_expr.adb +++ b/src/vhdl/vhdl-sem_expr.adb @@ -1744,7 +1744,6 @@ package body Vhdl.Sem_Expr is Err := True; end if; end if; - Left := Eval_Expr_Check_If_Static (Left, Left_Type); Check_Read (Left); Set_Left (Expr, Left); if Is_Dyadic then @@ -1756,17 +1755,26 @@ package body Vhdl.Sem_Expr is Err := True; end if; end if; - Right := Eval_Expr_Check_If_Static (Right, Right_Type); Check_Read (Right); Set_Right (Expr, Right); end if; if not Err then Set_Implementation (Expr, Decl); Sem_Subprogram_Call_Finish (Expr, Decl); - return Eval_Expr_If_Static (Expr); - else - return Expr; + if Get_Expr_Staticness (Expr) = Locally then + return Eval_Expr_If_Static (Expr); + else + -- The result is not static, but an operand may be static. + -- Evaluate it. + Left := Eval_Expr_Check_If_Static (Left, Left_Type); + Set_Left (Expr, Left); + if Is_Dyadic then + Right := Eval_Expr_Check_If_Static (Right, Right_Type); + Set_Right (Expr, Right); + end if; + end if; end if; + return Expr; end Set_Operator_Unique_Interpretation; -- Display an error message for sem_operator. -- cgit v1.2.3