From 926b893b005c0dbade106f04f9e2dddb781e8ec1 Mon Sep 17 00:00:00 2001 From: gingold Date: Fri, 26 Feb 2010 05:46:58 +0000 Subject: Handle overflow in physical expression. --- evaluation.adb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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) -- cgit v1.2.3