aboutsummaryrefslogtreecommitdiffstats
path: root/src/vhdl/vhdl-evaluation.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2021-11-15 20:55:24 +0100
committerTristan Gingold <tgingold@free.fr>2021-11-15 20:55:24 +0100
commit7dffc94d45464aff04bc2270c3cf0230ee788a0a (patch)
tree6b1c26fc2ca01c5eeed8e004f04662f66c8cbf79 /src/vhdl/vhdl-evaluation.adb
parent5b688c3a7fc164800c95a2133c1aaa5cf80c84c0 (diff)
downloadghdl-7dffc94d45464aff04bc2270c3cf0230ee788a0a.tar.gz
ghdl-7dffc94d45464aff04bc2270c3cf0230ee788a0a.tar.bz2
ghdl-7dffc94d45464aff04bc2270c3cf0230ee788a0a.zip
vhdl-evaluation: catch bad parameter for value attribute. Fix #1913
Diffstat (limited to 'src/vhdl/vhdl-evaluation.adb')
-rw-r--r--src/vhdl/vhdl-evaluation.adb8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/vhdl/vhdl-evaluation.adb b/src/vhdl/vhdl-evaluation.adb
index cde9c2fcd..36ca4c1af 100644
--- a/src/vhdl/vhdl-evaluation.adb
+++ b/src/vhdl/vhdl-evaluation.adb
@@ -2768,6 +2768,7 @@ package body Vhdl.Evaluation is
Last := Last - 1;
end loop;
+ -- TODO: do not use 'value, use the same function as the scanner.
declare
Value1 : String renames Value (First .. Last);
begin
@@ -2777,12 +2778,17 @@ package body Vhdl.Evaluation is
when Iir_Kind_Enumeration_Type_Definition =>
return Build_Enumeration_Value (Value1, Base_Type, Orig);
when Iir_Kind_Floating_Type_Definition =>
- return Build_Floating (Fp64'value (Value1), Orig);
+ return Build_Floating (Fp64'Value (Value1), Orig);
when Iir_Kind_Physical_Type_Definition =>
return Build_Physical_Value (Value1, Base_Type, Orig);
when others =>
Error_Kind ("eval_value_attribute", Base_Type);
end case;
+ exception
+ when Constraint_Error =>
+ Warning_Msg_Sem (Warnid_Runtime_Error, +Orig,
+ "incorrect parameter for value attribute");
+ return Build_Overflow (Orig);
end;
end Eval_Value_Attribute;