<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 - Issue in opt --place-safepoints flag"
   href="https://bugs.llvm.org/show_bug.cgi?id=51019">51019</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Issue in opt --place-safepoints flag
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>11.0
          </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>Scalar Optimizations
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>kavindu175@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>LLVM IR :
; ModuleID = 'test.c'
source_filename = "test.c"
target datalayout =
"e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"

; Function Attrs: noinline nounwind optnone uwtable
define dso_local i32 @foo() #0 {
  %1 = alloca i32, align 4
  %2 = load i32, i32* %1, align 4
  ret i32 %2
}

; Function Attrs: noinline nounwind optnone uwtable
define dso_local i32 @main() #0 gc "statepoint-example" {
  %1 = alloca i32*, align 8
  %2 = call noalias i8 addrspace(1)* @malloc(i64 5) #2
  %3 = bitcast i8 addrspace(1)* %2 to i32 addrspace(1)*
  %_4 = call i32 @foo()
  %_3_cast = addrspacecast i32 addrspace(1)* %3 to i32*
  store i32* %_3_cast, i32** %1, align 8
  ret i32 0
}

; Function Attrs: nounwind
declare dso_local noalias i8 addrspace(1)* @malloc(i64) #1

I am getting the following error for the above LLVM IR. Commands are shown
below.

command : opt-11 --place-safepoints test.ll -S

error :
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: opt-11 --place-safepoints test.ll -S 
1.      Running pass 'Function Pass Manager' on module 'test.ll'.
2.      Running pass 'Place Safepoints' on function '@main'
/lib/x86_64-linux-gnu/libLLVM-11.so.1(_ZN4llvm3sys15PrintStackTraceERNS_11raw_ostreamE+0x1f)[0x7f5d75a5842f]
/lib/x86_64-linux-gnu/libLLVM-11.so.1(_ZN4llvm3sys17RunSignalHandlersEv+0x50)[0x7f5d75a56790]
/lib/x86_64-linux-gnu/libLLVM-11.so.1(+0xaa6905)[0x7f5d75a58905]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x153c0)[0x7f5d74fa43c0]
/lib/x86_64-linux-gnu/libLLVM-11.so.1(_ZN4llvm8CallInstC1EPNS_12FunctionTypeEPNS_5ValueERKNS_5TwineEPNS_11InstructionE+0x18)[0x7f5d75b4a628]
/lib/x86_64-linux-gnu/libLLVM-11.so.1(+0x169ece8)[0x7f5d76650ce8]
/lib/x86_64-linux-gnu/libLLVM-11.so.1(_ZN4llvm13FPPassManager13runOnFunctionERNS_8FunctionE+0x3b9)[0x7f5d75b67579]
/lib/x86_64-linux-gnu/libLLVM-11.so.1(_ZN4llvm13FPPassManager11runOnModuleERNS_6ModuleE+0x33)[0x7f5d75b6cb23]
/lib/x86_64-linux-gnu/libLLVM-11.so.1(_ZN4llvm6legacy15PassManagerImpl3runERNS_6ModuleE+0x3e0)[0x7f5d75b67b90]
opt-11(main+0x26ff)[0x42d94f]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3)[0x7f5d74a780b3]
opt-11(_start+0x2e)[0x41bcde]
Segmentation fault (core dumped)</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>