[llvm-bugs] [Bug 42081] New: Illegal instruction (core dumped) when running the target program optimized with "opt -instcombine -licm -inline -jump-threading -argpromotion -early-cse -ipsccp -instcombine -memcpyopt -gvn -instcombine -globalopt"

via llvm-bugs llvm-bugs at lists.llvm.org
Thu May 30 19:43:03 PDT 2019


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

            Bug ID: 42081
           Summary: Illegal instruction (core dumped) when running the
                    target program optimized with "opt -instcombine -licm
                    -inline -jump-threading -argpromotion -early-cse
                    -ipsccp -instcombine -memcpyopt -gvn -instcombine
                    -globalopt"
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: cszide at 163.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 22057
  --> https://bugs.llvm.org/attachment.cgi?id=22057&action=edit
.bc file of the source code

$ cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c
      8  Intel(R) Core(TM) i7-7700 CPU @ 3.60GHz

$clang -v
clang version 9.0.0 (trunk 355281)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/jack-zhou/Documents/llvm/llvm_truck/llvm/build4/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.5.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.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.3.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64

$clang -O3 -c -emit-llvm  -mllvm -disable-llvm-optzns small.c

$clang small.bc -o small1.out && ./small1.out

$opt -instcombine -licm -inline  -jump-threading -argpromotion -early-cse
-ipsccp -instcombine -memcpyopt -gvn -instcombine -globalopt  small.bc -o
small-opt.bc

$ clang small-opt.bc -o small2.out && ./small2.out
Illegal instruction (core dumped)

without globalopt pass, the target program also has a Segmentation fault
problem.
$opt  -instcombine -licm -inline  -jump-threading -argpromotion -early-cse
-ipsccp -instcombine -memcpyopt -gvn -instcombine   small.bc -o small-opt1.bc

$clang small-opt1.bc -o small3.out && ./small3.out
Segmentation fault (core dumped)

------------------------------------------------
int a, x, k, i, g, f, b;
int *c;
int **d = &c;
int ***e = &d;
int ****h = &e;

void l(int **r) {
  int s[9][8][3] = {0};
  int *z = &s[1][0][0];
  int t = 0;
  for (a=0;a<1;a++) {
    int u[][7][6] = {0};
    int *v[][3][10] = {0,           &s[0][3][0], 0,  &i,
                       &s[7][7][2], &s[0][3][0], &t, &u[3][6][1],
                       &u[3][6][1], &t};
    for (g=0; g <= 1;g++) {
      int **w = &z;
      *w = ***h = *r;
    }
  }
}

int **m(int y, int *z, unsigned char a, unsigned char b) {
  for (; x;)
    ;
  for (f = 4; f;) {
    int **aa = &c;
    return aa;
  }
  return 0;
}

short int n() {
  l(m(0, &b, 4, 4));
  return 0;
}

void main() { n(); }

-- 
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/20190531/400834b4/attachment.html>


More information about the llvm-bugs mailing list