[LLVMbugs] [Bug 16036] New: incorrect loop optimization at -O3 in 32-bit mode

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu May 16 12:21:07 PDT 2013


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

            Bug ID: 16036
           Summary: incorrect loop optimization at -O3 in 32-bit mode
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: dhazeghi at yahoo.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

On x86_64-linux, the code below is miscompiled at -O3 optimization with the
current clang trunk, but only in 32-bit mode.

$ clang-trunk --version
clang version 3.4 (trunk 181995)
Target: x86_64-pc-linux-gnu
Thread model: posix
$ clang-trunk -O2 -m32 small.c
$ ./a.out 
0
$ clang-trunk -O3 -m64 small.c
$ ./a.out 
0
$ clang-trunk -O3 -m32 small.c
$ ./a.out 
1

--------------------

int printf (const char *, ...);
char a;
int b, c, d = 1;
void
fn1 ()
{
    b = 1;
    for (; b <= 4; b++)
    {
        c &= (
        {
            int e = ((
            {
                a;
            }) ^ 1) > 0;
            e << 1;
        });
        d = 0;
        for (; d <= 0; d++)
            if (b)
                break;
    }
}

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

-- 
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/20130516/be828567/attachment.html>


More information about the llvm-bugs mailing list