[llvm-bugs] [Bug 48456] New: wrong code with "-early-cse-memssa -jump-threading -loop-unroll -correlated-propagation -dse"

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Dec 9 05:09:00 PST 2020


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

            Bug ID: 48456
           Summary: wrong code with "-early-cse-memssa -jump-threading
                    -loop-unroll -correlated-propagation -dse"
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: suochenyao at 163.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

Created attachment 24254
  --> https://bugs.llvm.org/attachment.cgi?id=24254&action=edit
bc file

*******************************************************************************
OS and Platform:
CentOS Linux release 7.8.2003 (Core), x86_64 GNU/Linux
*******************************************************************************
Program:
$ cat a.c
int printf(const char *, ...);
int a=0;
static int b(int *c) {
  char d;
  int e, f;
  int g[1];
  f = 0;
  for (; f < 1; f++)
    g[f] = 0;
  *c = g[0];
}
int main() {
  int e;
  int *h = &a;
  b(h);
  printf("%d\n", a);
}
*******************************************************************************
clang version:
$ clang --version
clang version 12.0.0 (/home/suocy/src/llvm-dev/llvm-project/llvm/tools/clang
64e7685368894742517524878716184a8cd3ba9b)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/suocy/bin/llvm-dev/bin
*******************************************************************************
Command Lines:
$ clang -c -emit-llvm -O3 -mllvm -disable-llvm-optzns a.c -o a.bc
a.c:11:1: warning: non-void function does not return a value [-Wreturn-type]
}
^
1 warning generated.
$ opt a.bc -o a.opt1.bc
$ opt -early-cse-memssa -jump-threading -loop-unroll -correlated-propagation
-dse a.bc -o a.opt2.bc
$ clang a.opt1.bc -o a1.o
$ clang a.opt2.bc -o a2.o
$ ./a1.o
0
$ ./a2.o
32767

-- 
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/20201209/6e1837aa/attachment-0001.html>


More information about the llvm-bugs mailing list