[LLVMbugs] [Bug 5045] New: multiply by zero sometimes != zero

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Thu Sep 24 14:50:00 PDT 2009


           Summary: multiply by zero sometimes != zero
           Product: new-bugs
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: alexmac at adobe.com
                CC: llvmbugs at cs.uiuc.edu, alexmac at adobe.com

Created an attachment (id=3556)
 --> (http://llvm.org/bugs/attachment.cgi?id=3556)
bugfix- svn diff output

The constant folding code makes an invalid assumption that "X * 0 = 0", this is
not true if X turns out to be a special number such as INF or NAN. Here is a
test case that demonstrates the breakage:

#include <stdio.h>
#include <math.h>

double somefunc(int x) {
    return x ? INFINITY : NAN;
int main() {
    printf("inf * 0 = %G\n", somefunc(1) * 0);
    printf("NAN * 0 = %G\n", somefunc(0) * 0);

fix is attached

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list