mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
target-arm: fix sdiv helper
(INT32_MIN / -1) triggers an overflow, and the result depends on the host architecture (INT32_MIN on arm, -1 on ppc, SIGFPE on x86). Use a test to output the correct value. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> Acked-by: Laurent Desnogues <laurent.desnogues@gmail.com>
This commit is contained in:
parent
7bbcb0afe7
commit
686eeb93d5
1 changed files with 2 additions and 0 deletions
|
@ -402,6 +402,8 @@ int32_t HELPER(sdiv)(int32_t num, int32_t den)
|
|||
{
|
||||
if (den == 0)
|
||||
return 0;
|
||||
if (num == INT_MIN && den == -1)
|
||||
return INT_MIN;
|
||||
return num / den;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue