summaryrefslogtreecommitdiff
path: root/src/vhdl/translate/trans-chap4.adb
diff options
context:
space:
mode:
authorTristan Gingold2015-01-10 08:15:38 +0100
committerTristan Gingold2015-01-10 08:15:38 +0100
commitb467c5bb8e0c5e56eb756bf40a9dd548ef4c0633 (patch)
treeb5a75a67995d4068d94e30d121947858993a983f /src/vhdl/translate/trans-chap4.adb
parente3555e1493dd7a6579a44599c049ab9aa6552363 (diff)
downloadghdl-b467c5bb8e0c5e56eb756bf40a9dd548ef4c0633.tar.gz
ghdl-b467c5bb8e0c5e56eb756bf40a9dd548ef4c0633.tar.bz2
ghdl-b467c5bb8e0c5e56eb756bf40a9dd548ef4c0633.zip
Handle overflow during evaluation of type conversion. Forward on 'image.
Diffstat (limited to 'src/vhdl/translate/trans-chap4.adb')
-rw-r--r--src/vhdl/translate/trans-chap4.adb6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/vhdl/translate/trans-chap4.adb b/src/vhdl/translate/trans-chap4.adb
index 7c71cc7..3cbfc0b 100644
--- a/src/vhdl/translate/trans-chap4.adb
+++ b/src/vhdl/translate/trans-chap4.adb
@@ -543,7 +543,7 @@ package body Trans.Chap4 is
-- Create code to elaborate OBJ.
procedure Elab_Object (Obj : Iir)
is
- Value : Iir;
+ Value : constant Iir := Get_Default_Value (Obj);
Obj1 : Iir;
begin
-- A locally static constant is pre-elaborated.
@@ -551,6 +551,9 @@ package body Trans.Chap4 is
if Get_Expr_Staticness (Obj) = Locally
and then Get_Deferred_Declaration (Obj) = Null_Iir
then
+ if Get_Kind (Value) = Iir_Kind_Overflow_Literal then
+ Chap6.Gen_Bound_Error (Obj);
+ end if;
return;
end if;
@@ -575,7 +578,6 @@ package body Trans.Chap4 is
-- Still use the default value of the not deferred constant.
-- FIXME: what about composite types.
- Value := Get_Default_Value (Obj);
Elab_Object_Value (Obj1, Value);
end Elab_Object;