[LLVMbugs] [Bug 17078] New: wrong code at -O3 on x86_64-linux-gnu (affecting 3.2, 3.3, trunk)

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Sep 3 00:16:54 PDT 2013


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: unassignedclangbugs at nondot.org
          Reporter: su at cs.ucdavis.edu
                CC: llvmbugs at cs.uiuc.edu
    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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130903/97702e05/attachment.html>


More information about the llvm-bugs mailing list