aboutsummaryrefslogtreecommitdiffstats
path: root/evaluation.adb
diff options
context:
space:
mode:
authorgingold <gingold@b72b5c32-5f01-0410-b925-b5c7b92870f7>2010-02-26 05:46:58 +0000
committergingold <gingold@b72b5c32-5f01-0410-b925-b5c7b92870f7>2010-02-26 05:46:58 +0000
commit926b893b005c0dbade106f04f9e2dddb781e8ec1 (patch)
treef1d0e185b29fbd83dd74d7d32764563b23dcea52 /evaluation.adb
parenta0f20fb14ae0e842a34b3255c067e58ee8bd9587 (diff)
downloadghdl-926b893b005c0dbade106f04f9e2dddb781e8ec1.tar.gz
ghdl-926b893b005c0dbade106f04f9e2dddb781e8ec1.tar.bz2
ghdl-926b893b005c0dbade106f04f9e2dddb781e8ec1.zip
Handle overflow in physical expression.
Diffstat (limited to 'evaluation.adb')
-rw-r--r--evaluation.adb8
1 files changed, 7 insertions, 1 deletions
diff --git a/evaluation.adb b/evaluation.adb
index 571dcadf0..07cc313f4 100644
--- a/evaluation.adb
+++ b/evaluation.adb
@@ -24,7 +24,9 @@ with Flags; use Flags;
with Std_Names;
package body Evaluation is
- function Get_Physical_Value (Expr : Iir) return Iir_Int64 is
+ function Get_Physical_Value (Expr : Iir) return Iir_Int64
+ is
+ pragma Unsuppress (Overflow_Check);
begin
case Get_Kind (Expr) is
when Iir_Kind_Physical_Int_Literal =>
@@ -35,6 +37,10 @@ package body Evaluation is
when others =>
Error_Kind ("get_physical_value", Expr);
end case;
+ exception
+ when Constraint_Error =>
+ Error_Msg_Sem ("arithmetic overflow in physical expression", Expr);
+ return Get_Value (Expr);
end Get_Physical_Value;
function Build_Integer (Val : Iir_Int64; Origin : Iir)