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

            Bug ID: 17078
           Summary: wrong code at -O3 on x86_64-linux-gnu (affecting 3.2,
                    3.3, trunk)
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

The following code is miscompiled by the current clang trunk (as well as clang
3.2 and 3.3) on x86_64-linux-gnu at -O3 in both 32-bit and 64-bit modes. 


$ clang-trunk -v 
clang version 3.4 (trunk 189735)
$ clang-trunk -O2 small.c
$ a.out
0
$ clang-trunk -O3 small.c
$ a.out
1
$ clang-3.3 -O3 small.c
$ a.out
1
$ clang-3.2 -O3 small.c
$ a.out
1
$ 


----------------------------------------


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

int a, b = 1, c, d, e, f;

int bar (int p)
{
  return p > 0 && 1 / p ? 1 : p;
}

int baz (int *u)
{
  int g, *h; 
  for (;; ++c)
    {
      int i, **j = &h;
      if (c)
    for (b = 0; b < 1; b = 1) 
      {
        if (a | bar (6 | f))
          return 0;
      }
      else
    *j = &i;
      *u = -4;
      *h = d & -8;
      g = **j + **j;
      if (*u >= g)
    return 0;
    }
}

int main ()
{
  baz (&e);
  printf ("%d\n", b);
  return 0;
}

-- 
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