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

           Summary: math bug
           Product: new-bugs
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: new bugs
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]


This bug is seen on Ubuntu Hardy on x86.

The history of this bug is interesting: versions up to and including 61026 do
the right thing.  Subsequent versions of llvm-gcc fail to build, reporting
bootstrap problems, until 61169, which builds but miscompiles this program. 
The bug remains up through 61514, the last one I tested.

reg...@john-home:~/volatile/tmp91$ llvm-gcc -O0 small.c -o small
reg...@john-home:~/volatile/tmp91$ ./small
32767
reg...@john-home:~/volatile/tmp91$ llvm-gcc -O1 small.c -o small
reg...@john-home:~/volatile/tmp91$ ./small
-1
reg...@john-home:~/volatile/tmp91$ cat small.c
#include <stdio.h>

short g_16;

void func_15 (void);
void func_15 (void)
{
  for (; g_16 < 1; g_16 = (short)((unsigned)g_16-1U))
    {
    }
}

int main (void)
{
  func_15 ();
  printf ("%d\n", g_16);
  return 0;
}


-- 
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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to