[LLVMbugs] [Bug 590] NEW: opt -scalarrepl miscompiles program containing undef that is not actually stored

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Sun Jun 26 13:52:45 PDT 2005


http://llvm.cs.uiuc.edu/bugs/show_bug.cgi?id=590

           Summary: opt -scalarrepl miscompiles program containing undef
                    that is not actually stored
           Product: tools
           Version: trunk
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P2
         Component: opt
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: bocchino at uiuc.edu


llvm-gcc miscompiles the following function:

void zero(char *p, int n) {
  int i;
  int out, undef;
  for (i = 0; i < n+1; ++i) {
    out = undef;
    undef = 0;
    if (i > 0)
      p[i-1] = out;
  }
}

This function zeros out n locations starting at p.  (out is undefined on iteration 0 of the loop, but it is 
not written there.)  llvm-gcc miscompiles this function to ret void.  I have narrowed the problem down 
to the scalarrepl pass.  When I compile with scalarrepl in, it fails, and with scalarrepl out it succeeds.



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.




More information about the llvm-bugs mailing list