[llvm-bugs] [Bug 42833] New: Incorrect result with -O3 -march=skx

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jul 30 13:23:50 PDT 2019


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

            Bug ID: 42833
           Summary: Incorrect result with -O3 -march=skx
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: Vsevolod.Livinskij at frtk.ru
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

Clang produces incorrect result with -O3 -march=skx

Reproducer:
#include <stdio.h>

int b;
unsigned c[49];
int d[49];

void i() {
  for (int g = 32; g <= 48; g++) {
    d[g] -= c[g] + b;
    c[g] += c[g] + b;
    b -= b;
  }
}

int main() {
  for (int g = 0; g < 49; ++g)
    c[g] = 3;
  i();
  printf("%d\n", d[36]);
}

Error:
>$ clang -O3 -march=skx small.c ; ./a.out
0
>$ clang -O0 -march=skx small.c ; ./a.out
-3

LLVM version:
clang version 10.0.0 (trunk 367162)
Target: x86_64-unknown-linux-gnu
Thread model: posix

-- 
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/20190730/9d5be5dc/attachment.html>


More information about the llvm-bugs mailing list