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

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu May 26 14:09:35 PDT 2011


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

           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


Sorry for the long test case but I already spent a while reducing this.  I
believe the test case is well-defined.

regehr at home:~$ clang -O2 small.c
regehr at home:~$ ./a.out
1
regehr at home:~$ clang -O3 small.c
regehr at home:~$ ./a.out
0
regehr at home:~$ clang -v
clang version 3.0 (trunk 132139)
Target: i386-pc-linux-gnu
Thread model: posix
regehr at home:~$ cat small.c
int printf (const char *, ...);

short safe_15 (short si1, short si2)
{
  return si2 == 0 ? 0 : si1 % si2;
}

short safe_56 (short ui1, short ui2)
{
  return ui2 == 0 ? 1 : ui1 / ui2;
}

int g_31;
long f0;
long f1;

int g_65[2][8][2] = {
  {{}, {}, {}, {0, 1}},
};

int g_72;

void func_57 (void)
{
  int *l_64 = &g_65[1][2][1];
  g_72 = safe_15 (safe_56 (1, f0), *l_64);
  *l_64 &= 1;
}

unsigned g_208; 

int main (void)
{
  for (; f0 < 1; f0 = 1)
    {
      func_57 ();
      for (g_208 = 0; g_208 <= 1; g_208++)
    for (f1 = 0; f1 <= 1; f1++)
      {
        g_65[g_208][g_31 + 2][g_208] = g_65[0][f1 + 2][g_208];
        func_57 ();
      }
    }
  printf ("%d\n", g_65[1][2][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