From 05c699a9d0c93a7e9bd15d8ac207ec62626867ec Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Fri, 17 Apr 2020 19:12:11 +0200 Subject: vhdl-evaluation: static out of bounds values are now a warning. For #1237 Also adjust 'Image attribute evaluation and translate for thin arrays. --- src/vhdl/vhdl-evaluation.adb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/vhdl/vhdl-evaluation.adb') 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; -- cgit v1.2.3