[LLVMbugs] [Bug 5886] New: possible wrong code bug

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Fri Dec 25 16:22:02 PST 2009


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

           Summary: possible wrong code bug
           Product: new-bugs
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         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


Seen using r92164 on Ubuntu 9.10 on x86.  The -O2 result is right, I think.

regehr at john-home:~$ clang -O2 small.c -o small
regehr at john-home:~$ ./small
g_11 = 1
regehr at john-home:~$ clang -O3 small.c -o small
regehr at john-home:~$ ./small
g_11 = 0
regehr at john-home:~$ cat small.c
#include <stdio.h>

volatile int g_9 = 0;
int g_11 = 0;
unsigned int g_40 = 20;

int foo(int si1, int si2)
{
  return si1/si2;
}

void func_4(int p_8)
{
    int *l_12 = &g_11;
    *l_12 |= foo(g_9, -10);
}

int func_33(int *p_34)
{
    *p_34 = (*p_34 + 1) <= g_40;
    return *p_34;
}

int main(void)
{
  int x = func_33(&g_11);
  func_4(x);
  printf("g_11 = %d\n", g_11);
  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