diff options
author | Tristan Gingold <tgingold@free.fr> | 2015-01-10 08:15:38 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2015-01-10 08:15:38 +0100 |
commit | b467c5bb8e0c5e56eb756bf40a9dd548ef4c0633 (patch) | |
tree | b5a75a67995d4068d94e30d121947858993a983f /src/vhdl/translate | |
parent | e3555e1493dd7a6579a44599c049ab9aa6552363 (diff) | |
download | ghdl-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')
-rw-r--r-- | src/vhdl/translate/trans-chap4.adb | 6 | ||||
-rw-r--r-- | src/vhdl/translate/trans-chap7.adb | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/src/vhdl/translate/trans-chap4.adb b/src/vhdl/translate/trans-chap4.adb index 7c71cc7e0..3cbfc0b74 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; diff --git a/src/vhdl/translate/trans-chap7.adb b/src/vhdl/translate/trans-chap7.adb index 9e721a932..6497f428f 100644 --- a/src/vhdl/translate/trans-chap7.adb +++ b/src/vhdl/translate/trans-chap7.adb @@ -3894,9 +3894,11 @@ package body Trans.Chap7 is -- Generate the error message Chap6.Gen_Bound_Error (Expr); - -- Create a dummy value + -- Create a dummy value, for type checking. But never + -- executed. L := Create_Temp (Otype); - if Tinfo.Type_Mode = Type_Mode_Fat_Acc then + if Tinfo.Type_Mode in Type_Mode_Fat then + -- For fat pointers or arrays. return New_Address (New_Obj (L), Tinfo.Ortho_Ptr_Type (Mode_Value)); else |