<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 - Front end seg faults in `Function Pass Manager` on attached cuda code"
   href="https://bugs.llvm.org/show_bug.cgi?id=41651">41651</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Front end seg faults in `Function Pass Manager` on attached cuda code
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </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>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>CUDA
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>robert.maynard@kitware.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=21847" name="attach_21847" title="minimal test case">attachment 21847</a> <a href="attachment.cgi?id=21847&action=edit" title="minimal test case">[details]</a></span>
minimal test case

When compiling the attached code with:
clang++-8 -std=c++11 -O3 -x cuda -fcuda-rdc --cuda-path=/usr/local/cuda
--cuda-gpu-arch=sm_60 -fno-crash-diagnostics submit_to_clang.cu

I get the following segfault:

```
0.      Program arguments: /usr/lib/llvm-8/bin/clang -cc1 -triple
nvptx64-nvidia-cuda -aux-triple x86_64-pc-linux-gnu -S -disable-free
-disable-llvm-verifier -discard-value-names -main-file-name submit_to_clang.cu
-mrelocation-model static -mthread-model posix -mdisable-fp-elim
-no-integrated-as -fuse-init-array -fcuda-is-device -fgpu-rdc
-mlink-builtin-bitcode /usr/local/cuda/nvvm/libdevice/libdevice.10.bc
-target-feature +ptx61 -target-cpu sm_60 -dwarf-column-info
-debugger-tuning=gdb -resource-dir /usr/lib/llvm-8/lib/clang/8.0.1
-internal-isystem /usr/lib/llvm-8/lib/clang/8.0.1/include/cuda_wrappers
-internal-isystem /usr/local/cuda/include -include
__clang_cuda_runtime_wrapper.h -internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/x86_64-linux-gnu/c++/7.3.0
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/x86_64-linux-gnu/c++/7.3.0
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/backward
-internal-isystem /usr/include/clang/8.0.1/include/ -internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/x86_64-linux-gnu/c++/7.3.0
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/x86_64-linux-gnu/c++/7.3.0
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/backward
-internal-isystem /usr/include/clang/8.0.1/include/ -internal-isystem
/usr/local/include -internal-isystem /usr/lib/llvm-8/lib/clang/8.0.1/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include
-internal-isystem /usr/local/include -internal-isystem
/usr/lib/llvm-8/lib/clang/8.0.1/include -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /include
-internal-externc-isystem /usr/include -O3 -std=c++11 -fdeprecated-macro
-fno-dwarf-directory-asm -fdebug-compilation-dir
/home/robert/Work/clang_bug_report -ferror-limit 19 -fmessage-length 381
-fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option
-fcolor-diagnostics -vectorize-loops -vectorize-slp -o
/tmp/submit_to_clang-fc95b6.s -x cuda submit_to_clang.cu 
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module 'submit_to_clang.cu'.
4.      Running pass 'NVPTX DAG->DAG Pattern Instruction Selection' on function
'@_ZNK4vtkm4exec22CellLocatorUniformGrid8FindCellERKNS_14ArrayPortalRefINS_3VecIfLi3EEEEE'
 #0 0x00007f5a792435af llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/lib/x86_64-linux-gnu/libLLVM-8.so.1+0x9715af)
 #1 0x00007f5a79241a00 llvm::sys::RunSignalHandlers()
(/usr/lib/x86_64-linux-gnu/libLLVM-8.so.1+0x96fa00)
 #2 0x00007f5a792439b8 (/usr/lib/x86_64-linux-gnu/libLLVM-8.so.1+0x9719b8)
 #3 0x00007f5a7c52c890 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
 #4 0x00007f5a7aa170d3
llvm::NVPTXTargetLowering::getPrototype[abi:cxx11](llvm::DataLayout const&,
llvm::Type*, std::vector<llvm::TargetLoweringBase::ArgListEntry,
std::allocator<llvm::TargetLoweringBase::ArgListEntry> > const&,
llvm::SmallVectorImpl<llvm::ISD::OutputArg> const&, unsigned int,
llvm::ImmutableCallSite) const
(/usr/lib/x86_64-linux-gnu/libLLVM-8.so.1+0x21450d3)
 #5 0x00007f5a7aa18f87
llvm::NVPTXTargetLowering::LowerCall(llvm::TargetLowering::CallLoweringInfo&,
llvm::SmallVectorImpl<llvm::SDValue>&) const
(/usr/lib/x86_64-linux-gnu/libLLVM-8.so.1+0x2146f87)
 #6 0x00007f5a7975beb5
llvm::TargetLowering::LowerCallTo(llvm::TargetLowering::CallLoweringInfo&)
const (/usr/lib/x86_64-linux-gnu/libLLVM-8.so.1+0xe89eb5)
 #7 0x00007f5a79778933
llvm::SelectionDAGBuilder::lowerInvokable(llvm::TargetLowering::CallLoweringInfo&,
llvm::BasicBlock const*) (/usr/lib/x86_64-linux-gnu/libLLVM-8.so.1+0xea6933)
 #8 0x00007f5a79764f49
llvm::SelectionDAGBuilder::LowerCallTo(llvm::ImmutableCallSite, llvm::SDValue,
bool, llvm::BasicBlock const*)
(/usr/lib/x86_64-linux-gnu/libLLVM-8.so.1+0xe92f49)
 #9 0x00007f5a797501bb llvm::SelectionDAGBuilder::visitCall(llvm::CallInst
const&) (/usr/lib/x86_64-linux-gnu/libLLVM-8.so.1+0xe7e1bb)
#10 0x00007f5a79745917 llvm::SelectionDAGBuilder::visit(llvm::Instruction
const&) (/usr/lib/x86_64-linux-gnu/libLLVM-8.so.1+0xe73917)
#11 0x00007f5a797cbb95
llvm::SelectionDAGISel::SelectBasicBlock(llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Instruction,
false, false, void>, false, true>,
llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Instruction, false,
false, void>, false, true>, bool&)
(/usr/lib/x86_64-linux-gnu/libLLVM-8.so.1+0xef9b95)
#12 0x00007f5a797cafc0
llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&)
(/usr/lib/x86_64-linux-gnu/libLLVM-8.so.1+0xef8fc0)
#13 0x00007f5a797c8466
llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&)
(/usr/lib/x86_64-linux-gnu/libLLVM-8.so.1+0xef6466)
#14 0x00007f5a794b2df4
llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
(/usr/lib/x86_64-linux-gnu/libLLVM-8.so.1+0xbe0df4)
#15 0x00007f5a79336680 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/usr/lib/x86_64-linux-gnu/libLLVM-8.so.1+0xa64680)
#16 0x00007f5a793368f3 llvm::FPPassManager::runOnModule(llvm::Module&)
(/usr/lib/x86_64-linux-gnu/libLLVM-8.so.1+0xa648f3)
#17 0x00007f5a79336cbe llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/usr/lib/x86_64-linux-gnu/libLLVM-8.so.1+0xa64cbe)
#18 0x00000000006db885 clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::HeaderSearchOptions const&, clang::CodeGenOptions const&,
clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout
const&, llvm::Module*, clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
(/usr/lib/llvm-8/bin/clang+0x6db885)
#19 0x0000000000d5367f (/usr/lib/llvm-8/bin/clang+0xd5367f)
#20 0x00000000011d9a03 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/lib/llvm-8/bin/clang+0x11d9a03)
#21 0x0000000000ada10f clang::FrontendAction::Execute()
(/usr/lib/llvm-8/bin/clang+0xada10f)
#22 0x0000000000a98c38
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/lib/llvm-8/bin/clang+0xa98c38)
#23 0x0000000000b5fbe6
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/lib/llvm-8/bin/clang+0xb5fbe6)
#24 0x00000000006a2e6c cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/lib/llvm-8/bin/clang+0x6a2e6c)
#25 0x00000000006a13b6 main (/usr/lib/llvm-8/bin/clang+0x6a13b6)
#26 0x00007f5a77bc3b97 __libc_start_main
/build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:344:0
#27 0x000000000069eada _start (/usr/lib/llvm-8/bin/clang+0x69eada)
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
```</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>