<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/112379>112379</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang++] Assertion `UserValue <= UserMaxValue && "value is too big"' failed.
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang:codegen,
crash-on-valid,
clang:frontend:fuzzer
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
yijan4845
</td>
</tr>
</table>
<pre>
**This testcase is generated by a fuzzer.**
Compiler Explorer: [https://godbolt.org/z/qcsh9qGrf](https://godbolt.org/z/qcsh9qGrf)
This valid code will crash on Clang Assertion Trunk, it seems that this goes back to clang-11:
```cpp
typedef int __attribute__((ext_vector_type(4294967295))) type;
void test() {
type x;
}
```
Stack dump:
```
clang++: /root/llvm-project/llvm/include/llvm/ADT/Bitfields.h:126: static T llvm::bitfields_details::Compressor<T, Bits, <anonymous> >::pack(T, T) [with T = unsigned int; unsigned int Bits = 6; bool <anonymous> = true]: Assertion `UserValue <= UserMaxValue && "value is too big"' 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 <source>
1. <eof> parser at end of file
2. <source>:2:6: LLVM IR generation of declaration 'test'
3. <source>:2:6: Generating code for declaration 'test'
#0 0x0000000003bae128 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3bae128)
#1 0x0000000003babdec llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3babdec)
#2 0x0000000003af9048 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#3 0x00007a6304c42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x00007a6304c969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#5 0x00007a6304c42476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#6 0x00007a6304c287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#7 0x00007a6304c2871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#8 0x00007a6304c39e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#9 0x00000000034cf4a8 llvm::AllocaInst::AllocaInst(llvm::Type*, unsigned int, llvm::Value*, llvm::Align, llvm::Twine const&, llvm::InsertPosition) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x34cf4a8)
#10 0x000000000435ebde clang::CodeGen::CodeGenFunction::CreateTempAlloca(llvm::Type*, llvm::Twine const&, llvm::Value*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x435ebde)
#11 0x000000000435ec2e clang::CodeGen::CodeGenFunction::CreateTempAllocaWithoutCast(llvm::Type*, clang::CharUnits, llvm::Twine const&, llvm::Value*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x435ec2e)
#12 0x0000000004365472 clang::CodeGen::CodeGenFunction::CreateTempAlloca(llvm::Type*, clang::CharUnits, llvm::Twine const&, llvm::Value*, clang::CodeGen::RawAddress*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4365472)
#13 0x00000000043393dc clang::CodeGen::CodeGenFunction::EmitAutoVarAlloca(clang::VarDecl const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x43393dc)
#14 0x000000000433cfcb clang::CodeGen::CodeGenFunction::EmitVarDecl(clang::VarDecl const&) (.part.0) CGDecl.cpp:0:0
#15 0x000000000433d226 clang::CodeGen::CodeGenFunction::EmitDecl(clang::Decl const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x433d226)
#16 0x0000000003f02277 clang::CodeGen::CodeGenFunction::EmitDeclStmt(clang::DeclStmt const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3f02277)
#17 0x0000000003f18e79 clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3f18e79)
#18 0x0000000003f10b25 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3f10b25)
#19 0x0000000003f18894 clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3f18894)
#20 0x0000000003f80d34 clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3f80d34)
#21 0x0000000003f92d1c clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3f92d1c)
#22 0x0000000003ffbb0a clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3ffbb0a)
#23 0x0000000003ff6825 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3ff6825)
#24 0x0000000003ff6ddb clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3ff6ddb)
#25 0x0000000004001303 clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (.part.0) CodeGenModule.cpp:0:0
#26 0x0000000004509516 (anonymous namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) ModuleBuilder.cpp:0:0
#27 0x00000000044fa0f8 clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x44fa0f8)
#28 0x0000000006646864 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6646864)
#29 0x0000000004507088 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4507088)
#30 0x00000000047c1509 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x47c1509)
#31 0x000000000474008e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x474008e)
#32 0x00000000048a70de clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x48a70de)
#33 0x0000000000cdc07f cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xcdc07f)
#34 0x0000000000cd3d8a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#35 0x000000000454ad99 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
#36 0x0000000003af94f4 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3af94f4)
#37 0x000000000454b38f 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
#38 0x0000000004510c8d clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4510c8d)
#39 0x0000000004511d7d 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+++0x4511d7d)
#40 0x00000000045196a5 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x45196a5)
#41 0x0000000000cd8f4f clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xcd8f4f)
#42 0x0000000000ba8474 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xba8474)
#43 0x00007a6304c29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#44 0x00007a6304c29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#45 0x0000000000cd383e _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xcd383e)
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/eJzkWl9z26i7_jTkhrFHQrL-XOTCseOc7nTndBpvz6UHAbLZSqAFlDr99GdAciwUOxv3xDt75tdJmwq9vDzPwwu8ArDWfCsYuwWzOzBb3uDW7KS6feZ_YhFn8eymkPT5FqA5QPP1jmtomDYEawa5hlsmmMKGUVg8QwzL9udPpqadMQiWIOj_Xci64RVT8H7fVFIxBaI5BLO7nTGNBtEcoBVAq62khazMVKotQKufAK3-InqX__WgSjBbApS93xzlw-Yd7idccQqJpAz-4FUFicJ6B6WAiwqLLZxrzZThUsC1asV3gBaQG6gZqzU0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