aboutsummaryrefslogtreecommitdiffstats
path: root/src/vhdl
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2020-09-28 07:40:23 +0200
committerTristan Gingold <tgingold@free.fr>2020-09-28 19:07:51 +0200
commit93699fae475d20b02852fce787f80993c1640fd1 (patch)
tree5bf9b399b9fd70a110730adbc3003d60d2902ef9 /src/vhdl
parentbe890bf9638870500f855dada9e30982911e2505 (diff)
downloadghdl-93699fae475d20b02852fce787f80993c1640fd1.tar.gz
ghdl-93699fae475d20b02852fce787f80993c1640fd1.tar.bz2
ghdl-93699fae475d20b02852fce787f80993c1640fd1.zip
vhdl-sem_expr: evaluate operands only if the operator result is not static.
Diffstat (limited to 'src/vhdl')
-rw-r--r--src/vhdl/vhdl-sem_expr.adb18
1 files changed, 13 insertions, 5 deletions
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.