From 2e52e07e6a18a89d06060f09f952d78d704d0c00 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Wed, 17 May 2017 06:54:29 +0200 Subject: ortho/mcode: detect overflow for i32 and i64 mul. --- src/ortho/mcode/ortho_code-x86-emits.adb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/ortho/mcode/ortho_code-x86-emits.adb') 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); -- cgit v1.2.3