<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 - Segmentation fault on "CallGraph Pass Manager" when attributor-cgscc pass is used"
   href="https://bugs.llvm.org/show_bug.cgi?id=49570">49570</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Segmentation fault on "CallGraph Pass Manager" when attributor-cgscc pass is used
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </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>Interprocedural Optimizations
          </td>
        </tr>

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

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

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=24635" name="attach_24635" title="small.bc">attachment 24635</a> <a href="attachment.cgi?id=24635&action=edit" title="small.bc">[details]</a></span>
small.bc

$clang -v
clang version 13.0.0 (<a href="https://github.com/llvm/llvm-project.git">https://github.com/llvm/llvm-project.git</a>
77394c12a48822bb7a9183408f922d90c1d563cd)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/jack-zhou/Documents/llvm/llvm_truck/llvm-project/build/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/10
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/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.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/10
Candidate multilib: .;@m64
Selected multilib: .;@m64

$clang -O3 -c -emit-llvm -femit-all-decls -mllvm -disable-llvm-optzns small.c
-o small.bc

$opt  -sroa  -attributor-cgscc  small.bc -o small-opt.bc
PLEASE submit a bug report to <a href="https://bugs.llvm.org/">https://bugs.llvm.org/</a> and include the crash
backtrace.
Stack dump:
0.      Program arguments:
/home/jack-zhou/Documents/llvm/llvm_truck/llvm-project/build/bin/opt -sroa
-attributor-cgscc small.bc -o small-opt.bc
1.      Running pass 'CallGraph Pass Manager' on module 'small.bc'.
 #0 0x000055d7d665a5ec llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm-project/build/bin/opt+0x2e865ec)
 #1 0x000055d7d66582b4 llvm::sys::RunSignalHandlers()
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm-project/build/bin/opt+0x2e842b4)
 #2 0x000055d7d6658423 SignalHandler(int) Signals.cpp:0:0
 #3 0x00007ff76f45d8a0 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x128a0)
 #4 0x000055d7d42256ad llvm::scc_iterator<llvm::CallGraph*,
llvm::GraphTraits<llvm::CallGraph*> >::DFSVisitOne(llvm::CallGraphNode*)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm-project/build/bin/opt+0xa516ad)
 #5 0x000055d7d4225fb8 llvm::scc_iterator<llvm::CallGraph*,
llvm::GraphTraits<llvm::CallGraph*> >::DFSVisitChildren()
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm-project/build/bin/opt+0xa51fb8)
 #6 0x000055d7d4226148 llvm::scc_iterator<llvm::CallGraph*,
llvm::GraphTraits<llvm::CallGraph*> >::GetNextSCC()
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm-project/build/bin/opt+0xa52148)
 #7 0x000055d7d553f5f9 (anonymous
namespace)::CGPassManager::runOnModule(llvm::Module&) CallGraphSCCPass.cpp:0:0
 #8 0x000055d7d5e09196 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm-project/build/bin/opt+0x2635196)
 #9 0x000055d7d414ac0d main
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm-project/build/bin/opt+0x976c0d)
#10 0x00007ff76e0a7b97 __libc_start_main
/build/glibc-2ORdQG/glibc-2.27/csu/../csu/libc-start.c:344:0
#11 0x000055d7d4213eaa _start
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm-project/build/bin/opt+0xa3feaa)
Segmentation fault (core dumped)

The source code of small.c is as follows.
--------------------------------------------------------
long a;
char c;
static char(fn1)(b) {}
static long(d)() { return a; }
int e, f;
void g() {
  long h;
  int i = 5;
  c = 0;
  h = d();
  f = fn1(h != e == i);
}</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>