<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - wrong code with "-inline -early-cse-memssa -simplifycfg -instcombine -loop-unroll""
   href="https://bugs.llvm.org/show_bug.cgi?id=48333">48333</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>wrong code with "-inline -early-cse-memssa -simplifycfg -instcombine -loop-unroll"
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>suochenyao@163.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=24220" name="attach_24220" title="bc file">attachment 24220</a> <a href="attachment.cgi?id=24220&action=edit" title="bc file">[details]</a></span>
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, c=0, d=0;
int b[10];
void e() {
  int *f = &d;
  d = -19;
  for (; d > 3; ++d)
    ;
  *f = (f == f) >> *f;
}
int main() {
  e();
  c = b[d];
  printf("%X\n", a);
}
*******************************************************************************
clang version:
$ clang --version
clang version 12.0.0 (/home/suocy/src/llvm-dev/llvm-project/llvm/tools/clang
f15b7869e5afbd6c24ef440b0b62593e80fbd24f)
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:9:11: warning: self-comparison always evaluates to true
[-Wtautological-compare]
  *f = (f == f) >> *f;
          ^
1 warning generated.
$ opt a.bc -o a.opt1.bc
$ clang a.opt1.bc -o a1.o
$ opt -inline -early-cse-memssa -simplifycfg -instcombine -loop-unroll a.bc -o
a.opt2.bc
$ clang a.opt2.bc -o a2.o
$ ./a1.o
0
$ ./a2.o
Segmentation fault</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>