Open d4wae89d498 opened 10 months ago
@llvm/issue-subscribers-clang-frontend
Author: None (d4wae89d498)
Confirmed: https://godbolt.org/z/nWaM7hb7s
Assertion:
clang++: /root/llvm-project/clang/include/clang/AST/Type.h:753:
const clang::ExtQualsTypeCommonBase* clang::QualType::getCommonPtr() const:
Assertion `!isNull() && "Cannot retrieve a NULL type pointer"' failed.
CC @rjmccall @Bigcheese
The following code do cause a segfault on clang.
Clang 14 dump from MacOS
cc test.c clang: error: unable to execute command: Segmentation fault: 11 clang: error: clang frontend command failed due to signal (use -v to see invocation) Apple clang version 14.0.0 (clang-1400.0.29.202) Target: x86_64-apple-darwin22.3.0 Thread model: posix InstalledDir: /Volumes/DATA/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin clang: note: diagnostic msg: ******************** PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT: Preprocessed source(s) and associated run script(s) are located at: clang: note: diagnostic msg: /var/folders/9n/8gxzr2d15ll6h880dgb9ywvr0000gn/T/test-28c338.c clang: note: diagnostic msg: /var/folders/9n/8gxzr2d15ll6h880dgb9ywvr0000gn/T/test-28c338.sh clang: note: diagnostic msg: Crash backtrace is located in clang: note: diagnostic msg: /Users/xxxx/Library/Logs/DiagnosticReports/clang_Clang 15 dump from Linux
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: /usr/lib/llvm-15/bin/clang -cc1 -triple x86_64-pc-linux-gnu -emit-obj -mrelax-all --mrelax-relocations -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name test.c -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -mllvm -treat-scalable-fixed-error-as-warning -debugger-tuning=gdb -fcoverage-compilation-dir=/home/ubuntu -resource-dir /usr/lib/llvm-15/lib/clang/15.0.7 -internal-isystem /usr/lib/llvm-15/lib/clang/15.0.7/include -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdebug-compilation-dir=/home/ubuntu -ferror-limit 19 -fgnuc-version=4.2.1 -fcolor-diagnostics -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/test-f3b56b.o -x c test.c 1. test.c:3:20: current parser token ';' 2. test.c:2:1: parsing function body 'main' 3. test.c:2:1: in compound statement ('{}') 4. test.c:3:2: block literal parsing 5. test.c:3:10: in compound statement ('{}') #0 0x00007f04d6f54481 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib/llvm-15/bin/../lib/libLLVM-15.so.1+0xf54481) #1 0x00007f04d6f5219e llvm::sys::RunSignalHandlers() (/usr/lib/llvm-15/bin/../lib/libLLVM-15.so.1+0xf5219e) #2 0x00007f04d6f549a6 (/usr/lib/llvm-15/bin/../lib/libLLVM-15.so.1+0xf549a6) #3 0x00007f04d583c460 (/lib/x86_64-linux-gnu/libc.so.6+0x3c460) #4 0x00007f04de975442 clang::Sema::ActOnCapScopeReturnStmt(clang::SourceLocation, clang::Expr*, clang::Sema::NamedReturnInfo&, bool) (/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15+0x1775442) #5 0x00007f04de9764ea clang::Sema::BuildReturnStmt(clang::SourceLocation, clang::Expr*, bool) (/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15+0x17764ea) #6 0x00007f04de97631e clang::Sema::ActOnReturnStmt(clang::SourceLocation, clang::Expr*, clang::Scope*) (/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15+0x177631e) #7 0x00007f04ddd6606b clang::Parser::ParseReturnStatement() (/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15+0xb6606b) #8 0x00007f04ddd5fe6d clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVectorClang 17 dump from Linux
``` 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: /usr/lib/llvm-17/bin/clang -cc1 -triple x86_64-pc-linux-gnu -emit-obj -mrelax-all -dumpdir a- -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name test.c -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/home/ubuntu -resource-dir /usr/lib/llvm-17/lib/clang/17 -internal-isystem /usr/lib/llvm-17/lib/clang/17/include -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdebug-compilation-dir=/home/ubuntu -ferror-limit 19 -fgnuc-version=4.2.1 -fcolor-diagnostics -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/test-c92739.o -x c test.c 1. test.c:3:20: current parser token ';' 2. test.c:2:1: parsing function body 'main' 3. test.c:2:1: in compound statement ('{}') 4. test.c:3:2: block literal parsing 5. test.c:3:10: in compound statement ('{}') #0 0x00007f19acacf126 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib/llvm-17/bin/../lib/libLLVM-17.so.1+0xccf126) #1 0x00007f19acacd360 llvm::sys::RunSignalHandlers() (/usr/lib/llvm-17/bin/../lib/libLLVM-17.so.1+0xccd360) #2 0x00007f19acacf7bb (/usr/lib/llvm-17/bin/../lib/libLLVM-17.so.1+0xccf7bb) #3 0x00007f19ab63c460 (/lib/x86_64-linux-gnu/libc.so.6+0x3c460) #4 0x00007f19b4de4238 clang::Sema::ActOnCapScopeReturnStmt(clang::SourceLocation, clang::Expr*, clang::Sema::NamedReturnInfo&, bool) (/usr/lib/llvm-17/bin/../lib/libclang-cpp.so.17+0x17e4238) #5 0x00007f19b4de5598 clang::Sema::BuildReturnStmt(clang::SourceLocation, clang::Expr*, bool) (/usr/lib/llvm-17/bin/../lib/libclang-cpp.so.17+0x17e5598) #6 0x00007f19b4de53ce clang::Sema::ActOnReturnStmt(clang::SourceLocation, clang::Expr*, clang::Scope*) (/usr/lib/llvm-17/bin/../lib/libclang-cpp.so.17+0x17e53ce) #7 0x00007f19b40e3fe6 clang::Parser::ParseReturnStatement() (/usr/lib/llvm-17/bin/../lib/libclang-cpp.so.17+0xae3fe6) #8 0x00007f19b40de5aa clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector