diff options
author | Tristan Gingold <tgingold@free.fr> | 2018-11-14 06:39:53 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2018-11-14 06:39:53 +0100 |
commit | 279fcbc246fc6438756b76cd4d3d5f1f3e4e1463 (patch) | |
tree | 3a11f301175db7618893a14726a1bf55e2e802c1 /src/vhdl/translate/trans-chap7.adb | |
parent | fe338385f6c077e5b55b1fa2fc0fe4033894857d (diff) | |
download | ghdl-279fcbc246fc6438756b76cd4d3d5f1f3e4e1463.tar.gz ghdl-279fcbc246fc6438756b76cd4d3d5f1f3e4e1463.tar.bz2 ghdl-279fcbc246fc6438756b76cd4d3d5f1f3e4e1463.zip |
Fix overflow detection for **, implement ** for i64.
Fix #683
Diffstat (limited to 'src/vhdl/translate/trans-chap7.adb')
-rw-r--r-- | src/vhdl/translate/trans-chap7.adb | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/vhdl/translate/trans-chap7.adb b/src/vhdl/translate/trans-chap7.adb index 20f7185d1..a0352a4dd 100644 --- a/src/vhdl/translate/trans-chap7.adb +++ b/src/vhdl/translate/trans-chap7.adb @@ -2456,11 +2456,24 @@ package body Trans.Chap7 is Right_Tree, Ghdl_Real_Exp); return New_Convert_Ov (Res, Res_Otype); when Iir_Predefined_Integer_Exp => - Res := Translate_Lib_Operator - (New_Convert_Ov (Left_Tree, Std_Integer_Otype), - Right_Tree, - Ghdl_Integer_Exp); - return New_Convert_Ov (Res, Res_Otype); + declare + Left_Tinfo : constant Type_Info_Acc := + Get_Info (Get_Type (Left)); + Opr : O_Dnode; + Etype : O_Tnode; + begin + case Type_Mode_Integers (Left_Tinfo.Type_Mode) is + when Type_Mode_I32 => + Opr := Ghdl_I32_Exp; + Etype := Ghdl_I32_Type; + when Type_Mode_I64 => + Opr := Ghdl_I64_Exp; + Etype := Ghdl_I64_Type; + end case; + Res := Translate_Lib_Operator + (New_Convert_Ov (Left_Tree, Etype), Right_Tree, Opr); + return New_Convert_Ov (Res, Res_Otype); + end; when Iir_Predefined_Array_Inequality | Iir_Predefined_Record_Inequality => |