[llvm-bugs] [Bug 35750] New: __builtin_mul_overflow with mixed sign int operands incorrect result
llvm-bugs at lists.llvm.org
Tue Dec 26 06:34:32 PST 2017
Bug ID: 35750
Summary: __builtin_mul_overflow with mixed sign int operands
Severity: release blocker
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: ruttenberg at reservoir.com
CC: llvm-bugs at lists.llvm.org
Created attachment 19603
Reproducer -- passes with gcc and clang 4.0
Attaching a test simplified from the gcc test suite.
Essentially unsigned int = ((signed) -1) * 1 == 1
Gcc gets ((unsigned) -1) as the result, which I think is right.
The bug originated with this change:
Author: Vedant Kumar <vsk at apple.com>
Date: Sat Dec 16 01:28:25 2017 +0000
Previously, the signed operand was sign extended to 33 bits and the unsigned
operand was zero extended to 33 bits and the multiply was carried out in
extended precision, which seems right.
Now we just negate the first operand if it is negative, which seems wrong.
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-bugs