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

    <tr>
        <th>Summary</th>
        <td>
            [Clang][Crash] Assertion failure in Clang 18 when using pre-increment operator on `_Complex double` struct fields
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang
      </td>
    </tr>

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

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

<pre>
    Compiler Explorer: https://gcc.godbolt.org/z/7rTbaPrGE

The reproducer:
```
struct T {
  _Complex double z;
} v;

_Complex double
foo (_Complex double z)
{
  ++v.z;
 return 0;
}
```

When compile it with `clang-18 -O0`, clang-18 outputs:
```
clang: /root/llvm-project/clang/include/clang/AST/APValue.h:552: clang::APValue& clang::APValue::getStructField(unsigned int): Assertion `isStruct() && "Invalid accessor"' 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 -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -O0 <source>
1.      <source>:9:3: current parser token 'return'
2.      <source>:7:1: parsing function body 'foo'
3.      <source>:7:1: in compound statement ('{}')
 #0 0x0000000003920cd8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3920cd8)
 #1 0x000000000391e9bc llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x391e9bc)
 #2 0x0000000003865258 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x00007f8947242520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x00007f89472969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #5 0x00007f8947242476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #6 0x00007f89472287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #7 0x00007f894722871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #8 0x00007f8947239e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
 #9 0x0000000007361be1 clang::APValue::getStructField(unsigned int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x7361be1)
#10 0x000000000740dff7 (anonymous namespace)::ExtractSubobjectHandler::result_type findSubobject<(anonymous namespace)::ExtractSubobjectHandler>((anonymous namespace)::EvalInfo&, clang::Expr const*, (anonymous namespace)::CompleteObject const&, (anonymous namespace)::SubobjectDesignator const&, (anonymous namespace)::ExtractSubobjectHandler&) ExprConstant.cpp:0:0
#11 0x0000000007419c31 (anonymous namespace)::ExprEvaluatorBase<(anonymous namespace)::ComplexExprEvaluator>::VisitMemberExpr(clang::MemberExpr const*) ExprConstant.cpp:0:0
#12 0x0000000007454104 clang::StmtVisitorBase<llvm::make_const_ptr, (anonymous namespace)::ComplexExprEvaluator, bool>::Visit(clang::Stmt const*) ExprConstant.cpp:0:0
#13 0x0000000007455684 (anonymous namespace)::ComplexExprEvaluator::VisitUnaryOperator(clang::UnaryOperator const*) ExprConstant.cpp:0:0
#14 0x0000000007454b1b clang::StmtVisitorBase<llvm::make_const_ptr, (anonymous namespace)::ComplexExprEvaluator, bool>::Visit(clang::Stmt const*) ExprConstant.cpp:0:0
#15 0x00000000074552e3 EvaluateComplex(clang::Expr const*, (anonymous namespace)::ComplexValue&, (anonymous namespace)::EvalInfo&) ExprConstant.cpp:0:0
#16 0x000000000741343a Evaluate(clang::APValue&, (anonymous namespace)::EvalInfo&, clang::Expr const*) ExprConstant.cpp:0:0
#17 0x000000000741db7b EvaluateAsRValue((anonymous namespace)::EvalInfo&, clang::Expr const*, clang::APValue&) ExprConstant.cpp:0:0
#18 0x000000000741e812 clang::Expr::EvaluateForOverflow(clang::ASTContext const&) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x741e812)
#19 0x00000000063972a4 clang::Sema::CheckForIntOverflow(clang::Expr const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x63972a4)
#20 0x00000000063f97dd clang::Sema::CheckCompletedExpr(clang::Expr*, clang::SourceLocation, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x63f97dd)
#21 0x000000000689431c clang::Sema::ActOnFinishFullExpr(clang::Expr*, clang::SourceLocation, bool, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x689431c)
#22 0x0000000006b23ebe clang::Sema::ActOnExprStmt(clang::ActionResult<clang::Expr*, true>, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x6b23ebe)
#23 0x00000000062b4be4 clang::Parser::ParseExprStatement(clang::Parser::ParsedStmtContext) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x62b4be4)
#24 0x00000000062ab3a7 clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&, clang::ParsedAttributes&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x62ab3a7)
#25 0x00000000062ac247 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x62ac247)
#26 0x00000000062ad151 clang::Parser::ParseCompoundStatementBody(bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x62ad151)
#27 0x00000000062aea6a clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x62aea6a)
#28 0x00000000061c9b41 clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x61c9b41)
#29 0x00000000062011bc 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+0x62011bc)
#30 0x00000000061bdade clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x61bdade)
#31 0x00000000061be2d3 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x61be2d3)
#32 0x00000000061c5746 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x61c5746)
#33 0x00000000061c65ed clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x61c65ed)
#34 0x00000000061b92ca clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x61b92ca)
#35 0x00000000041bd968 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x41bd968)
#36 0x000000000443cfe9 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x443cfe9)
#37 0x00000000043c66de clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x43c66de)
#38 0x000000000452009e clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x452009e)
#39 0x0000000000c29b5c cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xc29b5c)
#40 0x0000000000c22dea ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#41 0x00000000042008e9 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
#42 0x0000000003865704 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3865704)
#43 0x0000000004200edf 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
#44 0x00000000041c7275 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x41c7275)
#45 0x00000000041c7cdd 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+0x41c7cdd)
#46 0x00000000041cfa45 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x41cfa45)
#47 0x0000000000c26ff5 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xc26ff5)
#48 0x0000000000b1d474 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xb1d474)
#49 0x00007f8947229d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#50 0x00007f8947229e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#51 0x0000000000c228de _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xc228de)
clang: error: clang frontend command failed with exit code 134 (use -v to see invocation)
Compiler returned: 134
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzkW91y27iSfhr6BiUVCf5f-EKRo1lPZcqu2Dt7qQLBpoQ1BXAB0JHn6bcAUD-gZdnOKFOnzkklCkUCja-_bnQ3QIgoxVYc4DpIvwTpzRXp9VrI6x8MpBb8qhL1y_VcbDrWgkRft10rJMggnqG11p0K4lmAFwFerCidrkRdiVZPhVwFePFXgBe5fKzIvfztaxDeBOHMfT6uAUnopKh7akUND7Nw-Gu_Ki17qtEjCvIv7g5CSwOkhS2qRV-1gP4K4uFZkN-g58M3-zlq7W42QqAAF68l4XInaT9cgL8E-Mvz9DAMkqB7yVF4PPBJ-O7zf9bAEXXsIabRD6bXKMhC2hK-mkQFmtzZLniO9rdEr7teq7d4se0M_wFeSCF0gBdt-7yZdFL8L1Dz1bXAC8Zp29dwdGf28Gg-7_8kbQ_TdRDP0hQbWTuhQTwbngY4O3XXflmBfrDWWTBo6wAXPbc-VCPGtSEynqGZUiA1E9yoy5RrH-AiwCUKcGbEBxjf8mfSshoRSkEpIQOMA5yjhrAW6qlT-P7b19nDV6T6asM0IqjqV8Z9hNRIi7EXMr3uqykVm4GW1-wwpXpQAV4gwg1gyxHSa0BUErVGFaFPWhIKxiid9VODDWqkRC_dbdOTKCUoIxpqJHuOFJWs0wPkB03oE6r7Tbe3YjgNwvJeipUkG0Tkqt8At0Y2dhSdtdswyyawm2WD5SZkR6aaaNnzpwAvKsZ3j9FkVf8gspkkaLJCE-PfC9J1Rq51palCk41hAU0m2yKbELWZqBeuyTaIbxjX0KLJA5pMVpROtBAtXRPGg_jm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