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

            Bug ID: 19618
           Summary: do-loop miscompiled
           Product: clang
           Version: 3.4
          Hardware: Other
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

$ cat clang-loop-bug.c
#include <stdio.h>
#include <assert.h>

int main ()
{
   unsigned u = 0xffffffff;
   unsigned v1 = 0, v2 = 0;
   do
      v1 |= u;
   while (u--);
   printf ("v1 = <%u>\n", v1);
   u = 0xffffffff;
   do
      v2 |= u;
   while (--u);
   printf ("v2 = <%u>\n", v2);
   assert (v1 == v2);
   return 0;
}
$ clang -O clang-loop-bug.c
$ ./a.out
v1 = <0>
v2 = <4294967295>
a.out: clang-loop-bug.c:17: int main(): Assertion `v1 == v2' failed.
Aborted

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