<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/54822>54822</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Clang asserts: "Must both be vector types" when assigning to atomic vector
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang:frontend
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
hubert-reinterpretcast
</td>
</tr>
</table>
<pre>
**SOURCE (`<stdin>`):**
```c
typedef int A __attribute__((__vector_size__(16)));
_Atomic(A) atm;
A old;
void f(void) { atm = old; }
```
**COMPILER INVOCATION COMMAND:**
```
clang -cc1 -triple x86_64-pc-linux-gnu -fsyntax-only -xc -
```
**ACTUAL OUTPUT:**
```
clang: /root/llvm-project/clang/lib/AST/ExprConstant.cpp:10432: bool {anonymous}::VectorExprEvaluator::VisitBinaryOperator(const clang::BinaryOperator*): Assertion `LHS->getType()->isVectorType() && RHS->getType()->isVectorType() && "Must both be vector types"' 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 -g -o /app/output.s -mllvm --x86-asm-syntax=intel -S --gcc-toolchain=/opt/compiler-explorer/gcc-9.2.0 -fcolor-diagnostics -fno-crash-diagnostics <source>
1. <source>:6:27: current parser token '}'
2. <source>:6:14: parsing function body 'f'
3. <source>:6:14: in compound statement ('{}')
#0 0x000055746e909e9f PrintStackTraceSignalHandler(void*) Signals.cpp:0:0
#1 0x000055746e907c04 llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3b07c04)
#2 0x000055746e83dac8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#3 0x00007f6e60eb43c0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x143c0)
#4 0x00007f6e6098103b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4303b)
#5 0x00007f6e60960859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
#6 0x00007f6e60960729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
#7 0x00007f6e60972006 (/lib/x86_64-linux-gnu/libc.so.6+0x34006)
#8 0x00005574715f8b62 (anonymous namespace)::VectorExprEvaluator::VisitBinaryOperator(clang::BinaryOperator const*) ExprConstant.cpp:0:0
#9 0x00005574715d3955 clang::StmtVisitorBase<llvm::make_const_ptr, (anonymous namespace)::VectorExprEvaluator, bool>::Visit(clang::Stmt const*) ExprConstant.cpp:0:0
#10 0x00005574715d4db5 EvaluateVector(clang::Expr const*, clang::APValue&, (anonymous namespace)::EvalInfo&) ExprConstant.cpp:0:0
#11 0x00005574715d52ce Evaluate(clang::APValue&, (anonymous namespace)::EvalInfo&, clang::Expr const*) ExprConstant.cpp:0:0
#12 0x00005574715d7cae EvaluateAsRValue((anonymous namespace)::EvalInfo&, clang::Expr const*, clang::APValue&) ExprConstant.cpp:0:0
#13 0x00005574715d8f6f clang::Expr::EvaluateForOverflow(clang::ASTContext const&) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x67d8f6f)
#14 0x0000557470a2df60 clang::Sema::CheckForIntOverflow(clang::Expr*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x5c2df60)
#15 0x0000557470a6d309 clang::Sema::CheckCompletedExpr(clang::Expr*, clang::SourceLocation, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x5c6d309)
#16 0x0000557470d7f641 clang::Sema::ActOnFinishFullExpr(clang::Expr*, clang::SourceLocation, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x5f7f641)
#17 0x0000557470f8bf04 clang::Sema::ActOnExprStmt(clang::ActionResult<clang::Expr*, true>, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x618bf04)
#18 0x000055747097c913 clang::Parser::ParseExprStatement(clang::Parser::ParsedStmtContext) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x5b7c913)
#19 0x000055747097d4d4 clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x5b7d4d4)
#20 0x000055747097de8c clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x5b7de8c)
#21 0x000055747097e9e9 clang::Parser::ParseCompoundStatementBody(bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x5b7e9e9)
#22 0x000055747097ee8b clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x5b7ee8b)
#23 0x00005574708dcd83 clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x5adcd83)
#24 0x0000557470903127 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x5b03127)
#25 0x00005574708d84b9 clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x5ad84b9)
#26 0x00005574708d8c71 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (.part.281) Parser.cpp:0:0
#27 0x00005574708de090 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x5ade090)
#28 0x00005574708df521 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x5adf521)
#29 0x00005574708d358b clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x5ad358b)
#30 0x000055746f972a30 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4b72a30)
#31 0x000055746f3013b1 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x45013b1)
#32 0x000055746f29b0aa clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x449b0aa)
#33 0x000055746f3d0683 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x45d0683)
#34 0x000055746c224b91 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x1424b91)
#35 0x000055746c220a29 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) driver.cpp:0:0
#36 0x000055746c16a00f main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x136a00f)
#37 0x00007f6e609620b3 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x240b3)
#38 0x000055746c22059a _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x142059a)
```
**EXPECTED OUTPUT:**
No assertion failure.
**COMPILER VERSION INFO (`clang -target x86_64-pc-linux-gnu -v`):**
```
clang version 15.0.0 (https://github.com/llvm/llvm-project.git a76209c265bdaca09d46ca4744c2d6e3602c908a)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /opt/compiler-explorer/clang-assertions-trunk/bin
Found candidate GCC installation: /opt/compiler-explorer/gcc-9.2.0/lib/gcc/x86_64-linux-gnu/9.2.0
Selected GCC installation: /opt/compiler-explorer/gcc-9.2.0/lib/gcc/x86_64-linux-gnu/9.2.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzNWl1v2zoS_TXOCyGD-pYe8qA4Tm-AtA5it9g3g6IoW1tZ1FJUrrO__g4p-YOq7aStu9jATWORmjnncDhDiUx59nY7chL4zGdfXyZTNHKiUYBH7qSRWVGN3Kn65sQjN-m6jfD9CCfqov7Q7rt8q1nGclRUEiVouSRSiiJtJVsulUEnWi5fGZVcLJviv91FO1Bmu49715vVv5eJ5JuCQh9wGCMiN_sOCeJltv_2yosM5dBP_aG6jsI71R2N3Pu-I1y6H0A-dtVxmsw-Pz8-TV_Q45dvs0myeJx9QXDtc_Ll_hzv7istSbVCFqU2soBwXTK0jYJl4Fk1tcqiarfWqmqRlTdvlSRbi1flG7K2FFnvYkomi6_JE5p9XTx_XXwABXSBsXsQnEv4ryxfN1Yt-L9BdPja9YDLRQq_k_kCfk-3tZjwqpGkkmNa12DAxp7rKEMp56USk1S8etvwtlEqAgY3-aZHUd07fSVlS-BL31A0hbwrKiLeZjUTusGJqHKAdgDhM-yRdLGFkqZhQha8QkDr6a-5BZG3YnIBcaUDKFYXiqZzf7gKlCGMAvTy03eMHOdzC9hSLtcoZagLT6QCuYG2kROinBQly8adyM9P02Q-RU2bbgqJCErbFRKs5kIiydFayrrRo_QAn1Uh1206pnzTD8WPI1I0TascPSBSZTBtaNlmDMk1Q1SQBhAR-l0KQgH1BNXgSHDKQKMMNbwV3WV1J2kaTgsioUG0FWooRKHsIc8lGEFZu1Fj213CY6R_ngVfCbJBRKzaDatk04cPr3W48E0N1IXFtnXJBRO7ELLIbpgaiPe2-g4NKWSJvhlZ8OHKDoF4AmutrFs5bpC1UfSRZcHsABsbq5sPME0hYbASWXNoW1FqSQg8uiYq8dxf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