aboutsummaryrefslogtreecommitdiffstats
path: root/src/vhdl/vhdl-evaluation.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2020-04-17 19:12:11 +0200
committerTristan Gingold <tgingold@free.fr>2020-04-17 19:12:11 +0200
commit05c699a9d0c93a7e9bd15d8ac207ec62626867ec (patch)
treedc1a4ca5d69cea9f14c9497ae0e6499777a911a3 /src/vhdl/vhdl-evaluation.adb
parentc2bb3d90014046dad616ac051e4938d0337184e9 (diff)
downloadghdl-05c699a9d0c93a7e9bd15d8ac207ec62626867ec.tar.gz
ghdl-05c699a9d0c93a7e9bd15d8ac207ec62626867ec.tar.bz2
ghdl-05c699a9d0c93a7e9bd15d8ac207ec62626867ec.zip
vhdl-evaluation: static out of bounds values are now a warning. For #1237
Also adjust 'Image attribute evaluation and translate for thin arrays.
Diffstat (limited to 'src/vhdl/vhdl-evaluation.adb')
-rw-r--r--src/vhdl/vhdl-evaluation.adb9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/vhdl/vhdl-evaluation.adb b/src/vhdl/vhdl-evaluation.adb
index b20c64b52..80dfd774d 100644
--- a/src/vhdl/vhdl-evaluation.adb
+++ b/src/vhdl/vhdl-evaluation.adb
@@ -2850,11 +2850,13 @@ package body Vhdl.Evaluation is
begin
Param := Get_Parameter (Expr);
Param := Eval_Static_Expr (Param);
- Eval_Check_Bound (Param, Get_Type (Get_Prefix (Expr)));
Set_Parameter (Expr, Param);
-- Special case for overflow.
- if Get_Kind (Param) = Iir_Kind_Overflow_Literal then
+ if Get_Kind (Param) = Iir_Kind_Overflow_Literal
+ or else not Eval_Is_In_Bound (Param,
+ Get_Type (Get_Prefix (Expr)))
+ then
return Build_Overflow (Expr);
end if;
@@ -3507,7 +3509,8 @@ package body Vhdl.Evaluation is
end if;
if not Eval_Is_In_Bound (Expr, Sub_Type) then
- Error_Msg_Sem (+Expr, "static expression violates bounds");
+ Warning_Msg_Sem (Warnid_Runtime_Error, +Expr,
+ "static expression violates bounds");
end if;
end Eval_Check_Bound;