aboutsummaryrefslogtreecommitdiffstats
path: root/src/vhdl/vhdl-parse_psl.adb
diff options
context:
space:
mode:
Diffstat (limited to 'src/vhdl/vhdl-parse_psl.adb')
-rw-r--r--src/vhdl/vhdl-parse_psl.adb16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/vhdl/vhdl-parse_psl.adb b/src/vhdl/vhdl-parse_psl.adb
index e456514bf..d6168ca23 100644
--- a/src/vhdl/vhdl-parse_psl.adb
+++ b/src/vhdl/vhdl-parse_psl.adb
@@ -48,12 +48,18 @@ package body Vhdl.Parse_Psl is
function Parse_Number return Node
is
+ V : Int64;
Res : Node;
begin
if Current_Token = Tok_Integer then
Res := Create_Node_Loc (N_Number);
-- FIXME: handle overflow.
- Set_Value (Res, Uns32 (Current_Iir_Int64));
+ V := Current_Iir_Int64;
+ if V > Int64 (Uns32'Last) then
+ Error_Msg_Parse ("number if too large");
+ V := Int64 (Uns32'Last);
+ end if;
+ Set_Value (Res, Uns32 (V));
Scan;
return Res;
elsif Current_Token = Tok_Inf then
@@ -70,9 +76,15 @@ package body Vhdl.Parse_Psl is
is
Low_B : constant Node := Get_Low_Bound (N);
High_B : constant Node := Get_High_Bound (N);
- Low : constant Uns32 := Get_Value (Low_B);
+ Low : Uns32;
High : Uns32;
begin
+ if Low_B = Null_Node then
+ -- Avoid crash on error.
+ return;
+ end if;
+
+ Low := Get_Value (Low_B);
if Get_Kind (High_B) = N_Inf then
return;
end if;