llvm / llvm/llvm-project

[clang] Crash in Sema::GetSignedVectorType on Assertion `TypeSize == Context.getTypeSize(Context.LongLongTy) && "Unhandled vector element size in vector compare"' failed.`

Open
#200,665 2 comments 0 reactions 0 assignees View on GitHub
clang:frontend confirmed crash regression:16
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

source code
```cxx
using i512x3 = _BitInt(512) __attribute__((ext_vector_type(3));
v3i512x3 a {a>0}
```
seems to be introduced since clang 16.0.0, cannot be reproduced on clang15.0.0

stacktrace:
```
^
clang++: /root/llvm-project/clang/lib/Sema/SemaExpr.cpp:13123: clang::QualType clang::Sema::GetSignedVectorType(clang::QualType): Assertion `TypeSize == Context.getTypeSize(Context.LongLongTy) && "Unhandled vector element size in vector compare"' 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-16.0.0/bin/clang++ -g -o /app/output.s -fno-verbose-asm -c --gcc-toolchain=/opt/compiler-explorer/gcc-12.2.0 -fcolor-diagnostics -fno-crash-diagnostics
1. :2:16: current parser token '}'
#0 0x0000651f8c77d32f llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x412e32f)
#1 0x0000651f8c77b2cc llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x412c2cc)
#2 0x0000651f8c6c7fb8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#3 0x00007a3f50e42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x00007a3f50e969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#5 0x00007a3f50e42476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#6 0x00007a3f50e287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#7 0x00007a3f50e2871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#8 0x00007a3f50e39e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#9 0x0000651f8f2cd456 (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x6c7e456)
#10 0x0000651f8f377007 clang::Sema::CheckVectorCompareOperands(clang::ActionResult&, clang::ActionResult&, clang::SourceLocation, clang::BinaryOperatorKind) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x6d28007)
#11 0x0000651f8f379e22 clang::Sema::CheckCompareOperands(clang::ActionResult&, clang::ActionResult&, clang::SourceLocation, clang::BinaryOperatorKind) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x6d2ae22)
#12 0x0000651f8f3826e8 clang::Sema::CreateBuiltinBinOp(clang::SourceLocation, clang::BinaryOperatorKind, clang::Expr*, clang::Expr*) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x6d336e8)
#13 0x0000651f8f383ddc clang::Sema::BuildBinOp(clang::Scope*, clang::SourceLocation, clang::BinaryOperatorKind, clang::Expr*, clang::Expr*) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x6d34ddc)
#14 0x0000651f8f384121 clang::Sema::ActOnBinOp(clang::Scope*, clang::SourceLocation, clang::tok::TokenKind, clang::Expr*, clang::Expr*) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x6d35121)
#15 0x0000651f8ee67b27 clang::Parser::ParseRHSOfBinaryExpression(clang::ActionResult, clang::prec::Level) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x6818b27)
#16 0x0000651f8ee8c1f9 clang::Parser::ParseBraceInitializer() (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x683d1f9)
#17 0x0000651f8ee27283 clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x67d8283)
#18 0x0000651f8ee38a28 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x67e9a28)
#19 0x0000651f8ee02e82 clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x67b3e82)
#20 0x0000651f8ee0372f clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (.part.0) Parser.cpp:0:0
#21 0x0000651f8ee08e89 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x67b9e89)
#22 0x0000651f8ee09e2d clang::Parser::ParseTopLevelDecl(clang::OpaquePtr&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x67bae2d)
#23 0x0000651f8edfe1ba clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x67af1ba)
#24 0x0000651f8daff3c8 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x54b03c8)
#25 0x0000651f8d36a659 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x4d1b659)
#26 0x0000651f8d2f11ee clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x4ca21ee)
#27 0x0000651f8d451a83 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x4e02a83)
#28 0x0000651f89ba82a6 cc1_main(llvm::ArrayRef, char const*, void*) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x15592a6)
#29 0x0000651f89ba4397 ExecuteCC1Tool(llvm::SmallVectorImpl&) driver.cpp:0:0
#30 0x0000651f8d1593b9 void llvm::function_ref::callback_fn>, std::__cxx11::basic_string, std::allocator>*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#31 0x0000651f8c6c84a0 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x40794a0)
#32 0x0000651f8d159c6f clang::driver::CC1Command::Execute(llvm::ArrayRef>, std::__cxx11::basic_string, std::allocator>*, bool*) const (.part.0) Job.cpp:0:0
#33 0x0000651f8d12230c clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x4ad330c)
#34 0x0000651f8d122d8d clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl>&, bool) const (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x4ad3d8d)
#35 0x0000651f8d12bf5c clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl>&) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x4adcf5c)
#36 0x0000651f89ba69f2 clang_main(int, char**) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x15579f2)
#37 0x00007a3f50e29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#38 0x00007a3f50e29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#39 0x0000651f89b9f07e _start (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x155007e)
clang-16: error: clang frontend command failed with exit code 134 (use -v to see invocation)
Compiler returned: 134
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.