<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/69352>69352</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang: Assertion `NumPositiveBits <= BestWidth && "How could an initializer get larger than ULL?"' failed.
</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>
This bug is related to a C23 feature (_BigInt):
```
enum { B = 66666666666666666666wb };
```
When compile the above program with clang, clang triggers an assertion failure (Compiler Explorer: https://godbolt.org/z/M6a94abG6):
```
<source>:1:12: warning: '_BitInt' suffix for literals is a C23 extension [-Wc23-extensions]
1 | enum { B = 66666666666666666666wb };
| ^
clang: /root/llvm-project/clang/lib/Sema/SemaDecl.cpp:20114: void clang::Sema::ActOnEnumBody(clang::SourceLocation, clang::SourceRange, clang::Decl*, llvm::ArrayRef<clang::Decl*>, clang::Scope*, const clang::ParsedAttributesView&): Assertion `NumPositiveBits <= BestWidth && "How could an initializer get larger than ULL?"' 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-9.2.0 -fcolor-diagnostics -fno-crash-diagnostics -O0 <source>
1. <source>:1:36: current parser token ';'
#0 0x000000000372dc98 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x372dc98)
#1 0x000000000372b95c llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x372b95c)
#2 0x0000000003674298 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#3 0x00007f6d0d86d420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#4 0x00007f6d0d33000b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
#5 0x00007f6d0d30f859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
#6 0x00007f6d0d30f729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
#7 0x00007f6d0d320fd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
#8 0x00000000061f574e clang::Sema::ActOnEnumBody(clang::SourceLocation, clang::SourceRange, clang::Decl*, llvm::ArrayRef<clang::Decl*>, clang::Scope*, clang::ParsedAttributesView const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x61f574e)
#9 0x0000000005ed549b clang::Parser::ParseEnumBody(clang::SourceLocation, clang::Decl*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x5ed549b)
#10 0x0000000005edd490 clang::Parser::ParseEnumSpecifier(clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, clang::Parser::DeclSpecContext) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x5edd490)
#11 0x0000000005ed9393 clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*, clang::ImplicitTypenameContext) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x5ed9393)
#12 0x0000000005ea4224 clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x5ea4224)
#13 0x0000000005ea4b5f clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (.part.0) Parser.cpp:0:0
#14 0x0000000005eac504 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x5eac504)
#15 0x0000000005eacd2d clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x5eacd2d)
#16 0x0000000005ead170 clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x5ead170)
#17 0x0000000005e9fda2 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x5e9fda2)
#18 0x0000000004999d08 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4999d08)
#19 0x00000000041fd819 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x41fd819)
#20 0x000000000417ecbe clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x417ecbe)
#21 0x00000000042dc99e clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x42dc99e)
#22 0x0000000000befa36 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xbefa36)
#23 0x0000000000be72fa ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#24 0x0000000003fdaea9 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
#25 0x0000000003674744 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3674744)
#26 0x0000000003fdb49f 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
#27 0x0000000003fa3665 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3fa3665)
#28 0x0000000003fa40cd 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+0x3fa40cd)
#29 0x0000000003fabff5 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3fabff5)
#30 0x0000000000becedc clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xbecedc)
#31 0x0000000000ae7071 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xae7071)
#32 0x00007f6d0d311083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#33 0x0000000000be6dde _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xbe6dde)
clang: error: clang frontend command failed with exit code 134 (use -v to see invocation)
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzkWl1zozjW_jXKjQoXiO-LXDhOPJOpzNtdnbwzly4hCaxtkFhJJM78-i0BdhCx3elZ9-xOravTIUgcPec5nxLGWvNKMHYN4hsQ317hzmylun7hTBkprgpJX6-ftlzDoqsg11CxGhtGoZEQwxUKYcmw6RSDAGWbG17dCwNQDsIl8G-BvwSJP_7r_2SiayBIb-ANBOEtTI58XgoI0lsQ3hwVMPz_-5YJSGTT8ppBs2UQ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