Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

SEGV during C++17 variadic template instantiation #48046

Open Quuxplusone opened 3 years ago

Quuxplusone commented 3 years ago
Bugzilla Link PR49077
Status NEW
Importance P normal
Reported by Alison Chaiken (alison@she-devel.com)
Reported on 2021-02-07 10:43:10 -0800
Last modified on 2021-02-08 20:46:45 -0800
Version 11.0
Hardware PC Linux
CC blitzrakete@gmail.com, erik.pilkington@gmail.com, hstong@ca.ibm.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also
The code in question also causes g++ 10.2.1 to crash.   I'm sure it's egregious
undefined behavior.   Backtrace is below.   There is also a coredump that I can
send if that's helpful.   The g++ bug on related code is 98983.

/usr/bin/clang++ -std=c++17 -pthread -ggdb -Wall -Wextra -g -O0 -fno-inline -
fsanitize=address,undefined -I/home/alison/gitsrc/googletest/googletest/include
-I/usr/include/bcc -I/home/alison/gitsrc/folly -I/home/alison/gitsrc/gcc -
I/home/alison/gitsrc/Cpp-Exercises -ggdb -g -fsanitize=address -
L/home/alison/gitsrc/googletest/googletest/make -lpthread /usr/lib/x86_64-linux-
gnu/libbcc.a /usr/lib/x86_64-linux-gnu/libbcc-loader-static.a /usr/lib/x86_64-
linux-gnu/libbcc_bpf.a /home/alison/gitsrc/fbcode-install/folly/lib/libfolly.a
/home/alison/gitsrc/fbcode-install/folly/lib/libfolly_test_util.a
async_logger_improved.cc async_enqueue_improved.cc -o async_logger_improved
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash
backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: /usr/lib/llvm-11/bin/clang -cc1 -triple x86_64-pc-
linux-gnu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-
value-names -main-file-name async_logger_improved.cc -mrelocation-model static -
mframe-pointer=all -fmath-errno -fno-rounding-math -mconstructor-aliases -
munwind-tables -target-cpu x86-64 -fno-split-dwarf-inlining -debug-info-
kind=limited -dwarf-version=4 -debugger-tuning=gdb -resource-dir /usr/lib/llvm-
11/lib/clang/11.0.1 -I /home/alison/gitsrc/googletest/googletest/include -I
/usr/include/bcc -I /home/alison/gitsrc/folly -I /home/alison/gitsrc/gcc -I
/home/alison/gitsrc/Cpp-Exercises -internal-isystem /usr/bin/../lib/gcc/x86_64-
linux-gnu/10/../../../../include/c++/10 -internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/x86_64-linux-
gnu/c++/10 -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-
gnu/10/../../../../include/x86_64-linux-gnu/c++/10 -internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/backward -
internal-isystem /usr/local/include -internal-isystem /usr/lib/llvm-
11/lib/clang/11.0.1/include -internal-externc-isystem /usr/include/x86_64-linux-
gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -
O0 -Wall -Wextra -std=c++17 -fdeprecated-macro -fdebug-compilation-dir
/home/alison/gitsrc/BPF-sandbox -ferror-limit 19 -
fsanitize=address,alignment,array-bounds,bool,builtin,enum,float-cast-
overflow,function,integer-divide-by-zero,nonnull-attribute,null,pointer-
overflow,return,returns-nonnull-attribute,shift-base,shift-exponent,signed-
integer-overflow,unreachable,vla-bound,vptr -fsanitize-recover=alignment,array-
bounds,bool,builtin,enum,float-cast-overflow,function,integer-divide-by-
zero,nonnull-attribute,null,pointer-overflow,returns-nonnull-attribute,shift-
base,shift-exponent,signed-integer-overflow,vla-bound,vptr -fsanitize-system-
blacklist=/usr/lib/llvm-11/lib/clang/11.0.1/share/asan_blacklist.txt -fsanitize-
address-use-after-scope -fno-assume-sane-operator-new -pthread -fgnuc-
version=4.2.1 -fno-inline -fcxx-exceptions -fexceptions -fcolor-diagnostics -
faddrsig -o /tmp/async_logger_improved-2f1eb4.o -x c++ async_logger_improved.cc
1.      <eof> parser at end of file
2.      Per-file LLVM IR generation
3.      ./arg_classifier.h:67:6: Generating code for declaration
'arg_classify::maybe_insert_folly_sdt_probe'
4.      ./arg_classifier.h:70:73: LLVM IR generation of compound statement
('{}')
 #0 0x00007fd8e478ff8f llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/usr/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xbd0f8f)
 #1 0x00007fd8e478e2f0 llvm::sys::RunSignalHandlers() (/usr/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xbcf2f0)
 #2 0x00007fd8e4790465 (/usr/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xbd1465)
 #3 0x00007fd8eb968140 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14140)
 #4 0x00007fd8ea496e6d (/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x17d9e6d)
 #5 0x00007fd8ea4854b2 clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) (/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x17c84b2)
 #6 0x00007fd8ea588bf5 clang::CodeGen::CodeGenFunction::EmitAsmInput(clang::TargetInfo::ConstraintInfo const&, clang::Expr const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x18cbbf5)
 #7 0x00007fd8ea5835f0 clang::CodeGen::CodeGenFunction::EmitAsmStmt(clang::AsmStmt const&) (/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x18c65f0)
 #8 0x00007fd8ea57d335 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x18c0335)
 #9 0x00007fd8ea586eac clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x18c9eac)
#10 0x00007fd8ea5863ef
clang::CodeGen::CodeGenFunction::EmitCompoundStmt(clang::CompoundStmt const&,
bool, clang::CodeGen::AggValueSlot) (/usr/lib/x86_64-linux-gnu/libclang-
cpp.so.11+0x18c93ef)
#11 0x00007fd8ea57d8c6
clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*)
(/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x18c08c6)
#12 0x00007fd8ea57d1ae clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt
const*, llvm::ArrayRef<clang::Attr const*>) (/usr/lib/x86_64-linux-gnu/libclang-
cpp.so.11+0x18c01ae)
#13 0x00007fd8ea57e165
clang::CodeGen::CodeGenFunction::EmitIfStmt(clang::IfStmt const&)
(/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x18c1165)
#14 0x00007fd8ea57d3e7 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt
const*, llvm::ArrayRef<clang::Attr const*>) (/usr/lib/x86_64-linux-gnu/libclang-
cpp.so.11+0x18c03e7)
#15 0x00007fd8ea586eac
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot) (/usr/lib/x86_64-linux-gnu/libclang-
cpp.so.11+0x18c9eac)
#16 0x00007fd8ea5d20a8
clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*)
(/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x19150a8)
#17 0x00007fd8ea5d295c
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&) (/usr/lib/x86_64-linux-
gnu/libclang-cpp.so.11+0x191595c)
#18 0x00007fd8ea5e986a
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl,
llvm::GlobalValue*) (/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x192c86a)
#19 0x00007fd8ea5e41a2
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*) (/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x19271a2)
#20 0x00007fd8ea5dad01 clang::CodeGen::CodeGenModule::EmitDeferred()
(/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x191dd01)
#21 0x00007fd8ea5d9fd8 clang::CodeGen::CodeGenModule::Release()
(/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x191cfd8)
#22 0x00007fd8ea65acd4 (/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x199dcd4)
#23 0x00007fd8ea5c970a (/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x190c70a)
#24 0x00007fd8e9694763 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x9d7763)
#25 0x00007fd8eac600c8 clang::FrontendAction::Execute() (/usr/lib/x86_64-linux-
gnu/libclang-cpp.so.11+0x1fa30c8)
#26 0x00007fd8eac16641
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/lib/x86_64-
linux-gnu/libclang-cpp.so.11+0x1f59641)
#27 0x00007fd8eacc6200
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/lib/x86_64-
linux-gnu/libclang-cpp.so.11+0x2009200)
#28 0x00000000004131bf cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/lib/llvm-11/bin/clang+0x4131bf)
#29 0x00000000004115fe (/usr/lib/llvm-11/bin/clang+0x4115fe)
#30 0x000000000041140a main (/usr/lib/llvm-11/bin/clang+0x41140a)
#31 0x00007fd8e36f3d0a __libc_start_main ./csu/../csu/libc-start.c:308:16
#32 0x000000000040e89a _start (/usr/lib/llvm-11/bin/clang+0x40e89a)
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
Debian clang version 11.0.1-2
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
clang: note: diagnostic msg: Error generating preprocessed source(s).
make: *** [Makefile:71: async_logger_improved] Error 254
Quuxplusone commented 3 years ago

Source code is missing? Not entirely sure the GCC Bugzilla attachment is the same thing.

Quuxplusone commented 3 years ago

The code is in the branch crash-compilers here:

https://github.com/chaiken/BPF-sandbox/tree/crash-compilers

The code in main branch compiles and passes unit tests. I hadn't pushed the version in crash-compilers because it does not compile!