Skip to content
This repository has been archived by the owner on Feb 5, 2019. It is now read-only.

Fix signed multiplication with overflow #79

Merged
merged 1 commit into from
May 19, 2017

Conversation

parched
Copy link

@parched parched commented May 19, 2017

fixes rust-lang/rust#39056 and probably some other targets that haven't been noticed or added to rust yet.

For targets that don't have ISD::MULHS or ISD::SMUL_LOHI for the type
and the double width type is illegal, then the two operands are
sign extended to twice their size then multiplied to check for overflow.
The extended upper halves were mismatched causing an incorrect result.
This fixes the mismatch.

A test was added for ARM V6-M where the bug was detected.

Patch by James Duley.

Differential Revision: https://reviews.llvm.org/D31807



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301404 91177308-0d34-0410-b5e6-96231b3b80d8
@parched parched changed the title Fix signed multiplation with overflow Fix signed multiplication with overflow May 19, 2017
@alexcrichton
Copy link
Member

Thanks!

@alexcrichton alexcrichton merged commit 5edb164 into rust-lang:rust-llvm-2017-04-13 May 19, 2017
nagisa added a commit to nagisa/rust that referenced this pull request Jun 8, 2017
Includes rust-lang/llvm#80
Includes rust-lang/llvm#79

Also adds tests and thus fixes rust-lang#24194
arielb1 pushed a commit that referenced this pull request Jun 27, 2017
Fix signed multiplication with overflow
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants