[LLVMbugs] [Bug 19618] New: do-loop miscompiled

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Apr 30 13:34:27 PDT 2014


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: unassignedclangbugs at nondot.org
          Reporter: kdevel at vogtner.de
                CC: llvmbugs at cs.uiuc.edu
    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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140430/7d800083/attachment.html>


More information about the llvm-bugs mailing list