[llvm-bugs] [Bug 39499] New: wrong code at -O3 on x86_64-linux-gnu in 64-bit mode (not in 32-bit mode)

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Oct 30 05:01:33 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=39499

            Bug ID: 39499
           Summary: wrong code at -O3 on x86_64-linux-gnu in 64-bit mode
                    (not in 32-bit mode)
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: su at cs.ucdavis.edu
                CC: llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

Tested with trunk revision 345488. 

$ clangpolly -v
clang version 8.0.0 (http://llvm.org/git/clang.git
8029b38886dd239769e3501dac21438e16886ce8) (llvm/trunk 345488)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/su/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9.4
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.2.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$ 
$ clangpolly -m64 -O2 small.c
$ ./a.out
$ 
$ clangpolly -m32 -O3 small.c
$ ./a.out
$ 
$ clangpolly -m64 -O3 small.c
$ ./a.out
Floating point exception (core dumped)
$ 


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


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

long a, b, i;
int c, f, g = 1, j, k, l, m = 6, n = 3;
short d = 4;
char e, h;

int main () 
{
  while (1)
    {
    L:
      for (; j < 10; j++)
        {
          for (h = 2; h >= 0; h--)
            while (1)
              {
                if (l)
                  f = 2;
                int q = 9L / g / ~e | (n ^ c) | f, t = 9 & -(~e / q & g);
                char aa = ~(~i * -c & ~f) / n ^ t ^ 9;
                long ab;
                if (d)
                  break;
                if (e)
                  ab = i = ~(e & 9L * (g * aa) & ~c & f) & n;
                e = ~(n / -i * e & ab) | -(-aa | g);
                i = ~i / ~e / q ^ ~t;
                if (g)
                  {
                    printf ("%d\n", e);
                    goto L;
                  }
                while (h > b)
                  ;
                g = c = e;
                break;
              }
          for (n = 0; n < 10; n++)
            if (a && h < c)
              break;
          if (k)
            {
              printf ("%d\n", k);
              continue;
            }
          f = h % (unsigned) 9;
        }

      if (f > 3)
        m = 0;
      int s = 46744073709551608 % m;
      if (s)
        break;
    }
  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/20181030/f6f7dfe7/attachment.html>


More information about the llvm-bugs mailing list