<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/63951>63951</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Enabling SYCL asserts when including compiler-provided headers
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          AaronBallman
      </td>
    </tr>
</table>

<pre>
    The following example causes an assertion ([live example](https://godbolt.org/z/rTxbnffbP)):
```
#include <immintrin.h>

int main() {
  return 0;
}
```
which causes:
```
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/clang++ -gdwarf-4 -g -o /app/output.s -mllvm --x86-asm-syntax=intel -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -fsycl <source>
1.      /opt/compiler-explorer/clang-assertions-trunk-20230714/lib/clang/17/include/avx512bf16intrin.h:54:1: current parser token 'static'
2.      /opt/compiler-explorer/clang-assertions-trunk-20230714/lib/clang/17/include/avx512bf16intrin.h:38:44: LLVM IR generation of declaration '_mm_cvtsbh_ss'
3.      /opt/compiler-explorer/clang-assertions-trunk-20230714/lib/clang/17/include/avx512bf16intrin.h:38:44: Mangling declaration '_mm_cvtsbh_ss'
 #0 0x000056532ae9ac1a llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3a9ac1a)
 #1 0x000056532ae9884c llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3a9884c)
 #2 0x000056532ade7020 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x00007ff712677420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #4 0x000056532e243e44 (anonymous namespace)::CXXNameMangler::mangleType(clang::QualType) ItaniumMangle.cpp:0:0
 #5 0x000056532e24d60e (anonymous namespace)::CXXNameMangler::mangleBareFunctionType(clang::FunctionProtoType const*, bool, clang::FunctionDecl const*) ItaniumMangle.cpp:0:0
 #6 0x000056532e258772 (anonymous namespace)::CXXNameMangler::mangleFunctionEncoding(clang::GlobalDecl) ItaniumMangle.cpp:0:0
 #7 0x000056532e257bce (anonymous namespace)::CXXNameMangler::mangle(clang::GlobalDecl) ItaniumMangle.cpp:0:0
 #8 0x000056532e25a679 (anonymous namespace)::ItaniumMangleContextImpl::mangleCXXName(clang::GlobalDecl, llvm::raw_ostream&) ItaniumMangle.cpp:0:0
 #9 0x000056532e27974c clang::MangleContext::mangleName(clang::GlobalDecl, llvm::raw_ostream&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6e7974c)
#10 0x000056532b20c244 getMangledNameImpl(clang::CodeGen::CodeGenModule&, clang::GlobalDecl, clang::NamedDecl const*, bool) CodeGenModule.cpp:0:0
#11 0x000056532b20d4c7 clang::CodeGen::CodeGenModule::getMangledName(clang::GlobalDecl) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3e0d4c7)
#12 0x000056532b233585 clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3e33585)
#13 0x000056532b23ae63 clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (.part.8518) CodeGenModule.cpp:0:0
#14 0x000056532bf6a260 (anonymous namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) ModuleBuilder.cpp:0:0
#15 0x000056532bf5daee clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4b5daee)
#16 0x000056532d23a214 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5e3a214)
#17 0x000056532bf67560 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4b67560)
#18 0x000056532b8892e9 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x44892e9)
#19 0x000056532b81dc42 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x441dc42)
#20 0x000056532b960c9f clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4560c9f)
#21 0x0000565328622cc3 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x1222cc3)
#22 0x000056532861ade8 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#23 0x000056532b6912f9 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#24 0x000056532ade74a5 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x39e74a5)
#25 0x000056532b693eee clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4293eee)
#26 0x000056532b66060b clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x426060b)
#27 0x000056532b6611e3 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x42611e3)
#28 0x000056532b669fd6 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4269fd6)
#29 0x0000565328620a8e clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x1220a8e)
#30 0x0000565328551cb1 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x1151cb1)
#31 0x00007ff712125083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#32 0x000056532861a4da _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x121a4da)
clang++: error: clang frontend command failed with exit code 139 (use -v to see invocation)
Compiler returned: 139
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzkmV9z2yoaxj8NuWHkkdD_i1w4TtJtJ93NNpkzZ688CCGbDQINIMfZT78Dkh3hOGnaOj0XZyZtYkDwex5eXrDAWrOVoPQcpBcgvTzDvVlLdT7HSooLzHmLxVkl66fz-zWFjeRcPjKxgnSL245TSHCvqYZYQKw1VYZJAQEqQHrB2YbumoH0EqBibUynQTwH6Bqg65WsK8nNTKoVQNf_A-ha3W8r0TTVLUCl_YnnILwE4Rxk4fgzfEQxE4T3NYUgXrC2ZcIoJmZrEF-NLdz_TBjYYiYsDiohyC-GcggVNb0SMATxWATyy6NDPa4ZWY8aX8O5vbma311B3VctMxDDql9BRTupDDQSHmhmZt1XMyJbgK453-x-BZ2S_6XEAHTNtO6pBugaYlHDnVCzppAorNewwuTBKEwoQAvYKdopSajWtIZa9mootk9irSVh2NAaql5ATRTrzGxAvjOYPMC6b7u9qHAGwvJWyZXCLcRq1bdUGAsOAbqWnSUjsu0Ypyqg245LRZUt41isgv3U68CoXjwAdF1Z34dqgC4AuoDBqn7EqgkSGKxgIG2_uOts773pejPT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