aboutsummaryrefslogtreecommitdiffstats
path: root/src/ortho/mcode
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2017-05-17 06:54:29 +0200
committerTristan Gingold <tgingold@free.fr>2017-05-18 07:59:34 +0200
commit2e52e07e6a18a89d06060f09f952d78d704d0c00 (patch)
tree2163084516951340b979aed2827eba402a51b4b1 /src/ortho/mcode
parent513bbe9ca27c2c3beaf315df8280586a21cae76a (diff)
downloadghdl-2e52e07e6a18a89d06060f09f952d78d704d0c00.tar.gz
ghdl-2e52e07e6a18a89d06060f09f952d78d704d0c00.tar.bz2
ghdl-2e52e07e6a18a89d06060f09f952d78d704d0c00.zip
ortho/mcode: detect overflow for i32 and i64 mul.
Diffstat (limited to 'src/ortho/mcode')
-rw-r--r--src/ortho/mcode/ortho_code-x86-emits.adb6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/ortho/mcode/ortho_code-x86-emits.adb b/src/ortho/mcode/ortho_code-x86-emits.adb
index 28f621af2..0e62eb6e3 100644
--- a/src/ortho/mcode/ortho_code-x86-emits.adb
+++ b/src/ortho/mcode/ortho_code-x86-emits.adb
@@ -2267,8 +2267,14 @@ package body Ortho_Code.X86.Emits is
Gen_Mul (Stmt, Sz_32);
when Mode_I32 =>
Gen_Grp3_Insn (Opc2_Grp3_Imul, Get_Expr_Right (Stmt), Sz_32);
+ if Kind = OE_Mul_Ov then
+ Gen_Check_Overflow (Mode);
+ end if;
when Mode_I64 =>
Gen_Grp3_Insn (Opc2_Grp3_Imul, Get_Expr_Right (Stmt), Sz_64);
+ if Kind = OE_Mul_Ov then
+ Gen_Check_Overflow (Mode);
+ end if;
when Mode_U64 =>
pragma Assert (Flags.M64);
Gen_Mul (Stmt, Sz_64);