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

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Sep 3 00:21:51 PDT 2013


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

            Bug ID: 17079
           Summary: wrong code at -O3 on x86_64-linux-gnu (affecting trunk
                    and 3.3)
           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 and clang 3.3 on
x86_64-linux-gnu at -O3 in both 32-bit and 64-bit modes. 

This is a regression from clang 3.2. 


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



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


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

int a = 0, e, f, g = 0, h, *j = &g, k, l, m, n;
volatile int b, d;
short c[2];

static void foo (int *p)
{
  int i;
  for (m = 0;; m = 0)
    {
      short *o = &c[1];
      for (a = 2; a >= 0; a--)
    {
      int *t = &e;
      b;
      for (h = 0; h <= 1; h++)
        if (c[0])
          {
        n = c[1];
        *t = 0;
          }
      int q[3][8] = { 0, 0, 0, 0, 0, l, 1, 1, 0, 0, 0, f, l, e, e, k }; 
      short *r = &c[1];
      for (i = 0; i < 3; i++)
        {
          *r = 0;
          b;
          c[0] = 0;
          *p = 1;
        }
    }
      d; 
      *o = 1; 
      b; 

      if (*p)
    break;
    }
}

int
main ()
{
  int *s = &g;
  foo (s);
  *j = c[1];
  printf ("%d\n", g);
  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/887d47e3/attachment.html>


More information about the llvm-bugs mailing list