[llvm-bugs] [Bug 35750] New: __builtin_mul_overflow with mixed sign int operands incorrect result
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Dec 26 06:34:32 PST 2017
https://bugs.llvm.org/show_bug.cgi?id=35750
Bug ID: 35750
Summary: __builtin_mul_overflow with mixed sign int operands
incorrect result
Product: new-bugs
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: release blocker
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: ruttenberg at reservoir.com
CC: llvm-bugs at lists.llvm.org
Created attachment 19603
--> https://bugs.llvm.org/attachment.cgi?id=19603&action=edit
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...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20171226/a97c15b7/attachment.html>
More information about the llvm-bugs
mailing list