[LLVMbugs] [Bug 16166] New: nested loops produces wrong result at -O3

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue May 28 11:18:47 PDT 2013


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

            Bug ID: 16166
           Summary: nested loops produces wrong result at -O3
           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

The following code produces incorrect results when compiled with current clang
trunk at -O3 on x86_64-linux.  This is a regression from clang 3.2.

$ clang-trunk -v
clang version 3.4 (trunk 182759)
Target: x86_64-pc-linux-gnu
Thread model: posix
$ clang-trunk -O2 wrong.c 
$ ./a.out 
-19
$ clang-3.2 -O3 wrong.c 
$ ./a.out 
-19
$ clang-trunk -O3 wrong.c 
$ ./a.out 
-564288184
$

---------------------
int printf (const char *, ...);
int a, b, c, d, e, f, g, h;

int
main ()
{
    f = 22;
    for (; f <= 53; f++)
    {
        b = 0;
        for (; b > -19; b--)
            if (e)
                break;
    }
    printf ("%d\n", b);
    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/20130528/eeb50caa/attachment.html>


More information about the llvm-bugs mailing list