llvm-project
llvm-project copied to clipboard
[lldb] Crash when printing `clang::CallExpr`: `Unexpected type for integer literal: _Bool`
trafficstars
$ cmake -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_C_FLAGS_RELWITHDEBINFO="-O1 -g -fno-optimize-sibling-calls" -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="-O1 -g -fno-optimize-sibling-calls" -DLLVM_ENABLE_PROJECTS='clang;lldb;cross-project-tests' -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_UNREACHABLE_OPTIMIZE=OFF -DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_ENABLE_LLD=ON ../../llvm
# using a relative close to head clang as host compiler
$ ninja lldb clang lldb-server
$ ./bin/lldb bin/clang -o 'im loo -t "clang::CallExpr"'
(lldb) im loo -t "clang::CallExpr"
Unexpected type for integer literal!
UNREACHABLE executed at /home/aeubanks/repos/llvm-project/clang/lib/AST/StmtPrinter.cpp:1280!
Dumping the type right before it crashes shows
BuiltinType 0x55853bdd30e0 '_Bool'
I've been unable to manually repro with _Bool in a small C/C++ example, which seems to map to normal bool.
Probably similar to #58135? @DavidSpickett
@llvm/issue-subscribers-lldb
Looks like it crashes on:
VarDecl 0x4ec36e380 <<invalid sloc>> <invalid sloc> NotADL 'const clang::CallExpr::ADLCallKind' static cinit
`-IntegerLiteral 0x4ec36e3f0 <<invalid sloc>> 'bool' 0
Shorter repro:
$ cat enum.cpp
struct S {
enum class ADLCallKind : bool { NotADL, UsesADL };
static constexpr ADLCallKind NotADL = ADLCallKind::NotADL;
static constexpr ADLCallKind UsesADL = ADLCallKind::UsesADL;
};
int main() {
S s;
return 0;
}
$ ./bin/lldb a.out
(lldb) im loo -t S
Unexpected type for integer literal!
UNREACHABLE executed at llvm-project/clang/lib/AST/StmtPrinter.cpp:1279!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: ./bin/lldb a.out
Abort trap: 6
Will probably need to extend what David did for bool initialisation in DWARFASTParserClang to bool enum types too