[LLVMbugs] [Bug 1813] New: llvm-gcc thinks that A*abs(B) == abs(A*B)

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Tue Nov 20 09:58:34 PST 2007


http://llvm.org/bugs/show_bug.cgi?id=1813

           Summary: llvm-gcc thinks that A*abs(B) == abs(A*B)
           Product: new-bugs
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: major
          Priority: P2
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: edwintorok at gmail.com
                CC: llvmbugs at cs.uiuc.edu


#include <stdio.h>
#include <stdlib.h>
int main( void )
{
  int i=2;
  if( -10*abs (i-1) == 10*abs(i-1) ) {
    printf ("-10==10!\n");
    abort();
  }
}

I just noticed this gcc bug (which affects all 3.x and 4.x except trunk):
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34130

llvm-gcc is affected by it too, even if I pass it -O0, and don't optimize the
bitcode at all. I think the bug is in the gcc frontend.

I think it would be useful to backport the gcc change to llvm-gcc 4.0/4.2.

I am a bit puzzled though, doesn't llvm use its own constant folding
implementation? [the gcc bug was in const-fold.c according to the commit on
gcc]


-- 
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