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

    <tr>
        <th>Summary</th>
        <td>
            [OpenACC] Assertion `Val && "isa<> used on a null pointer"' failed.
        </td>
    </tr>

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

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

    <tr>
      <th>Reporter</th>
      <td>
          k-arrows
      </td>
    </tr>
</table>

<pre>
    Reproducer:
https://godbolt.org/z/fqGKxTdEh
```cpp
void foo() {
  switch (int x = 0) {
  case 0:
#pragma acc parallel
 break;
  }
}
```

Backtrace:
```console
clang++: /root/llvm-project/llvm/include/llvm/Support/Casting.h:109: static bool llvm::isa_impl_cl<To, const From*>::doit(const From*) [with To = clang::Expr; From = clang::Stmt]: Assertion `Val && "isa<> used on a null pointer"' failed.
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 -fno-verbose-asm -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -fopenacc -fclangir <source>
1.      <eof> parser at end of file
2.      <source>:1:12: parsing function body 'foo'
 #0 0x0000000003f9b608 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3f9b608)
 #1 0x0000000003f99294 llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3f99294)
 #2 0x0000000003eddec8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x00007018e9442520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x00007018e94969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #5 0x00007018e9442476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #6 0x00007018e94287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #7 0x00007018e942871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #8 0x00007018e9439e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
 #9 0x0000000007331ec9 (anonymous namespace)::JumpScopeChecker::BuildScopeInformation(clang::Stmt*, unsigned int&) JumpDiagnostics.cpp:0:0
#10 0x0000000007330f97 (anonymous namespace)::JumpScopeChecker::BuildScopeInformation(clang::Stmt*, unsigned int&) JumpDiagnostics.cpp:0:0
#11 0x0000000007330580 (anonymous namespace)::JumpScopeChecker::BuildScopeInformation(clang::Stmt*, unsigned int&) JumpDiagnostics.cpp:0:0
#12 0x0000000007330580 (anonymous namespace)::JumpScopeChecker::BuildScopeInformation(clang::Stmt*, unsigned int&) JumpDiagnostics.cpp:0:0
#13 0x0000000007330580 (anonymous namespace)::JumpScopeChecker::BuildScopeInformation(clang::Stmt*, unsigned int&) JumpDiagnostics.cpp:0:0
#14 0x000000000733b2f6 clang::Sema::DiagnoseInvalidJumps(clang::Stmt*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x733b2f6)
#15 0x00000000069f2c42 clang::Sema::ActOnFinishFunctionBody(clang::Decl*, clang::Stmt*, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x69f2c42)
#16 0x00000000067454ef clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x67454ef)
#17 0x000000000663f4f3 clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x663f4f3)
#18 0x0000000006675e8d clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::Parser::ParsedTemplateInfo&, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6675e8d)
#19 0x000000000663303e clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x663303e)
#20 0x00000000066337f9 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x66337f9)
#21 0x000000000663b10a clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x663b10a)
#22 0x000000000663c0ad clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x663c0ad)
#23 0x000000000663c560 clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x663c560)
#24 0x000000000662e443 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x662e443)
#25 0x00000000049463b8 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x49463b8)
#26 0x0000000004c3e1d5 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4c3e1d5)
#27 0x0000000004bbce1e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4bbce1e)
#28 0x0000000004d30e49 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4d30e49)
#29 0x0000000000dac8df cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xdac8df)
#30 0x0000000000da2aaa ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#31 0x00000000049ad4b9 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
#32 0x0000000003ede364 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3ede364)
#33 0x00000000049adacf clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (.part.0) Job.cpp:0:0
#34 0x000000000496f89d clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x496f89d)
#35 0x000000000497092e 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+++0x497092e)
#36 0x0000000004978c15 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4978c15)
#37 0x0000000000da8848 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xda8848)
#38 0x0000000000c2e214 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xc2e214)
#39 0x00007018e9429d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#40 0x00007018e9429e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#41 0x0000000000da2555 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xda2555)
clang++: error: clang frontend command failed with exit code 134 (use -v to see invocation)
Compiler returned: 134
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzkml1v2zrSxz8Nc0PIoKj3i1woTtwnfbpo0QTn1qAoyuZGInVIKnX20y9IydFLErdZxMU5u0VSOBI5_M-Pw-GIFtGa7wRjlyC6AtH1BenMXqrLB48oJX_oi0KWT5ffWatk2VGmQJADlO-NabX9iDcAb3ayLGRtVlLtAN78C-BN9een_z_clzd7gHIQo_6Hti1A-aPkJaykBDgFOIMguQIoh1D_4IbuIcApFwYeIAiuIZo2oEQziPrhAQ5aRXYNgYRS2BJF6prVtlmhGHkAQd8FJNe2cf__UYX9jPIrQh-MIpQNBp81SqFlzQDKaU3EDuAr-xPkEOCNktIAvKnrx8Zrlfwno8c_Ad5wQeuuZOOFu65tpbIt1kQbLnarPQhyH2XWmjbEcAoLKWvo2gc5CHKuyZY3bb2lNQjW9xLgNbSCDNwo2QCcg-Cmb1lKbgBO5zctrOjqBzd7eC8dwN4H1-Pm0CoQXLnGy3t3pjEgurbCcq2ZMlwKCGL0B6khwDHAMQQYc01AsAbBDew0K6EUkEDR1TVsJReGKYAxwAmsCK9ZuQIo__blJr-7gborGm4ggUW3g4pZKNBIuAghbvZdsaLWkyPBBWiudcc0wBtIRAkH3tDsGaSK6D0snqcUr2GrbMRSpq1ULTvVX7Y9idaScmJYCVUnoKaKt8bqvTOEPsCya9o-KNAKoOybkjtFGkjUrmuYMHoIBtlaTVQ2La-Z8tihraWyEDYOrEeOILVnVCceAN4UXBxv93EFvV35g6jKC6G3g560dknbWuudaTuz0tBrLAXoeYc09ohuPP0kDDmA4Noyr6FXCek9MlVIzex96N1B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