<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 - Crash for target declare in non-offload mode"
   href="https://bugs.llvm.org/show_bug.cgi?id=43355">43355</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Crash for target declare in non-offload mode
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>OpenMP
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </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>Clang Compiler Support
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>jdoerfert@anl.gov
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The example below crashes for me locally (see further down) and produces odd
offloading description code here: <a href="https://godbolt.org/z/EHccgU">https://godbolt.org/z/EHccgU</a>

```
#pragma omp declare target
#include <cmath>
#pragma omp end declare target
```

```
lang-10: /data/src/llvm-project/clang/lib/CodeGen/CGOpenMPRuntime.cpp:3967:
llvm::Function*
clang::CodeGen::CGOpenMPRuntime::createOffloadingBinaryDescriptorRegistration():
Assertion `!Devices.empty() && "No OpenMP offloading devices??"' failed.
Stack dump:
0.      Program arguments: /data/build/llvm-project-release/bin/clang-10 -cc1
-triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-main-file-name crash2.cpp -mrelocation-model static -mthread-model posix
-mframe-pointer=all -fmath-errno -masm-verbose -mconstructor-aliases
-munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info
-debugger-tuning=gdb -resource-dir
/data/build/llvm-project-release/lib/clang/10.0.0 -internal-isystem
/usr/lib64/gcc/x86_64-pc-linux-gnu/9.1.0/../../../../include/c++/9.1.0
-internal-isystem
/usr/lib64/gcc/x86_64-pc-linux-gnu/9.1.0/../../../../include/c++/9.1.0/x86_64-pc-linux-gnu
-internal-isystem
/usr/lib64/gcc/x86_64-pc-linux-gnu/9.1.0/../../../../include/c++/9.1.0/backward
-internal-isystem /usr/local/include -internal-isystem
/data/build/llvm-project-release/lib/clang/10.0.0/include
-internal-externc-isystem /include -internal-externc-isystem /usr/include
-fdeprecated-macro -fdebug-compilation-dir /data/build/llvm-project-release
-ferror-limit 19 -fmessage-length 0 -fopenmp -fobjc-runtime=gcc
-fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics
-faddrsig -o /tmp/johannes/crash2-8bced6.o -x c++ crash2.cpp 
1.      <eof> parser at end of file
2.      Per-file LLVM IR generation
 #0 0x0000561803a2b3ea llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/data/build/llvm-project-release/bin/clang-10+0x2cab3ea)
 #1 0x0000561803a29144 llvm::sys::RunSignalHandlers()
(/data/build/llvm-project-release/bin/clang-10+0x2ca9144)
 #2 0x0000561803a292c5 SignalHandler(int)
(/data/build/llvm-project-release/bin/clang-10+0x2ca92c5)
 #3 0x00007f3c1e28ad00 __restore_rt (/usr/lib/libpthread.so.0+0x13d00)
 #4 0x00007f3c1db0e755 raise (/usr/lib/libc.so.6+0x3a755)
 #5 0x00007f3c1daf9851 abort (/usr/lib/libc.so.6+0x25851)
 #6 0x00007f3c1daf9727 _nl_load_domain.cold (/usr/lib/libc.so.6+0x25727)
 #7 0x00007f3c1db07026 (/usr/lib/libc.so.6+0x33026)
 #8 0x000056180405bf76
clang::CodeGen::CGOpenMPRuntime::createOffloadingBinaryDescriptorRegistration()
(.part.0) (/data/build/llvm-project-release/bin/clang-10+0x32dbf76)
 #9 0x0000561803da109b clang::CodeGen::CodeGenModule::Release()
(/data/build/llvm-project-release/bin/clang-10+0x302109b)
#10 0x000056180487b27a (anonymous
namespace)::CodeGeneratorImpl::HandleTranslationUnit(clang::ASTContext&)
(/data/build/llvm-project-release/bin/clang-10+0x3afb27a)
#11 0x0000561804879e0c
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/data/build/llvm-project-release/bin/clang-10+0x3af9e0c)
#12 0x000056180553e951 clang::ParseAST(clang::Sema&, bool, bool)
(/data/build/llvm-project-release/bin/clang-10+0x47be951)
#13 0x00005618048774c0 clang::CodeGenAction::ExecuteAction()
(/data/build/llvm-project-release/bin/clang-10+0x3af74c0)
#14 0x0000561804218059 clang::FrontendAction::Execute()
(/data/build/llvm-project-release/bin/clang-10+0x3498059)
#15 0x00005618041d627e
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/data/build/llvm-project-release/bin/clang-10+0x345627e)
#16 0x00005618042e9004
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/data/build/llvm-project-release/bin/clang-10+0x3569004)
#17 0x0000561801af0b04 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/data/build/llvm-project-release/bin/clang-10+0xd70b04)
#18 0x0000561801a74db1 main
(/data/build/llvm-project-release/bin/clang-10+0xcf4db1)
#19 0x00007f3c1dafaee3 __libc_start_main (/usr/lib/libc.so.6+0x26ee3)
#20 0x0000561801aecdae _start
(/data/build/llvm-project-release/bin/clang-10+0xd6cdae)
clang-10: error: unable to execute command: Aborted (core dumped)
clang-10: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 10.0.0 (<a href="mailto:git@github.com">git@github.com</a>:llvm/llvm-project.git
505127ddbfec7b77759dbb1c6255a9b44bda64bb)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /data/build/llvm-project-release/./bin
clang-10: note: diagnostic msg: PLEASE submit a bug report to
<a href="https://bugs.llvm.org/">https://bugs.llvm.org/</a> and include the crash backtrace, preprocessed source,
and associated run script.
clang-10: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-10: note: diagnostic msg: /tmp/johannes/crash2-38ec8f.cpp
clang-10: note: diagnostic msg: /tmp/johannes/crash2-38ec8f.sh
clang-10: note: diagnostic msg: 
```</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>