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: [email protected]
        ReportedBy: [email protected]
                CC: [email protected], [email protected]


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

regehr@home:~$ clang -O2 small.c
regehr@home:~$ ./a.out
1
regehr@home:~$ clang -O3 small.c
regehr@home:~$ ./a.out
0
regehr@home:~$ clang -v
clang version 3.0 (trunk 132139)
Target: i386-pc-linux-gnu
Thread model: posix
regehr@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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to