[LLVMbugs] [Bug 8854] New: likely wrong code bug

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Dec 25 10:17:54 PST 2010


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

           Summary: likely wrong code bug
           Product: new-bugs
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: regehr at cs.utah.edu
                CC: llvmbugs at cs.uiuc.edu, chenyang at cs.utah.edu


[regehr at gamow ~]$ clang -O0 small.c -o small
[regehr at gamow ~]$ ./small 
p_6 = 1
[regehr at gamow ~]$ clang -O1 small.c -o small
[regehr at gamow ~]$ ./small 
p_6 = 0
[regehr at gamow ~]$ clang -v 
clang version 2.9 (trunk 122551)
Target: x86_64-unknown-linux-gnu
Thread model: posix
[regehr at gamow ~]$ cat small.c
int g_403 = 1;
int g_462 = 0;

int printf(const char *format, ...);

int func_18(int p_22)
{
    return g_403;
}

unsigned short foo(unsigned short u1, unsigned short u2)
{
    return u1 * u2;
}

int func_3(unsigned char p_6)
{
    int *l_708[2];
    int i;
    for (i = 0; i < 2; i++)
    {
        l_708[i] = &g_462;
    }

    for (i = 0; i < 1; i++)
    {
        if (func_18(p_6) >= foo(1, p_6))
        {
            printf("p_6 = %d\n", p_6);
            return p_6;
        }
        if (l_708[0] == &g_462)
        {
            return 99;
        }
    }
    return 99;
}

int main(int argc, char* argv[])
{
    func_3(1);
    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.



More information about the llvm-bugs mailing list