Issue 90993
Summary Clang++ crashes when compiling from comand-line
Labels clang
Assignees
Reporter bluefish43
    Clang++ encountered a segmentation fault when compiling the input file.

Here is its output:
```
$ clang++ test.cc -o test -Wall -Werror
error: null character ignored [-Werror,-Wnull-character]
error: null character ignored [-Werror,-Wnull-character]
error: null character ignored [-Werror,-Wnull-character]
error: null character ignored [-Werror,-Wnull-character]
error: null character ignored [-Werror,-Wnull-character]
error: null character ignored [-Werror,-Wnull-character]
error: null character ignored [-Werror,-Wnull-character]
error: null character ignored [-Werror,-Wnull-character]
error: null character ignored [-Werror,-Wnull-character]
error: null character ignored [-Werror,-Wnull-character]
error: null character ignored [-Werror,-Wnull-character]
error: null character ignored [-Werror,-Wnull-character]
error: null character ignored [-Werror,-Wnull-character]
error: null character ignored [-Werror,-Wnull-character]
error: null character ignored [-Werror,-Wnull-character]
error: null character ignored [-Werror,-Wnull-character]
error: null character ignored [-Werror,-Wnull-character]
error: null character ignored [-Werror,-Wnull-character]
error: null character ignored [-Werror,-Wnull-character]
fatal error: too many errors emitted, stopping now [-ferror-limit=]
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/bin/clang-18 -cc1 -triple x86_64-suse-linux -emit-obj -mrelax-all -dumpdir test- -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name test.cc -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 -fdebug-compilation-dir=/home/user/Projetos/ccbuild -fcoverage-compilation-dir=/home/user/Projetos/ccbuild -resource-dir /usr/lib64/clang/18 -internal-isystem /usr/bin/../lib64/gcc/x86_64-suse-linux/13/../../../../include/c++/13 -internal-isystem /usr/bin/../lib64/gcc/x86_64-suse-linux/13/../../../../include/c++/13/x86_64-suse-linux -internal-isystem /usr/bin/../lib64/gcc/x86_64-suse-linux/13/../../../../include/c++/13/backward -internal-isystem /usr/lib64/clang/18/include -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -Wall -Werror -fdeprecated-macro -ferror-limit 19 -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fcxx-exceptions -fexceptions -fcolor-diagnostics -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/test-78294d.o -x c++ test.cc
1.      <unknown> parser at unknown location
 #0 0x00007f71d7bd9a09 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/lib64/libLLVM.so.18.1+0x9d9a09)
 #1 0x00007f71d7bd7430 llvm::sys::RunSignalHandlers() (/lib64/libLLVM.so.18.1+0x9d7430)
 #2 0x00007f71d7bda1fb (/lib64/libLLVM.so.18.1+0x9da1fb)
 #3 0x00007f71d6a41240 __restore_rt (/lib64/libc.so.6+0x41240)
 #4 0x00007f71df017305 clang::Lexer::SkipWhitespace(clang::Token&, char const*, bool&) (/lib64/libclang-cpp.so.18.1+0xa17305)
 #5 0x00007f71df01bc3e clang::Lexer::LexTokenInternal(clang::Token&, bool) (/lib64/libclang-cpp.so.18.1+0xa1bc3e)
 #6 0x00007f71df08663d clang::Preprocessor::Lex(clang::Token&) (/lib64/libclang-cpp.so.18.1+0xa8663d)
 #7 0x00007f71df09566e (/lib64/libclang-cpp.so.18.1+0xa9566e)
 #8 0x00007f71df167744 clang::Parser::SkipUntil(llvm::ArrayRef<clang::tok::TokenKind>, clang::Parser::SkipUntilFlags) (/lib64/libclang-cpp.so.18.1+0xb67744)
 #9 0x00007f71df167633 clang::Parser::SkipUntil(llvm::ArrayRef<clang::tok::TokenKind>, clang::Parser::SkipUntilFlags) (/lib64/libclang-cpp.so.18.1+0xb67633)
#10 0x00007f71df167633 clang::Parser::SkipUntil(llvm::ArrayRef<clang::tok::TokenKind>, clang::Parser::SkipUntilFlags) (/lib64/libclang-cpp.so.18.1+0xb67633)
#11 0x00007f71df167633 clang::Parser::SkipUntil(llvm::ArrayRef<clang::tok::TokenKind>, clang::Parser::SkipUntilFlags) (/lib64/libclang-cpp.so.18.1+0xb67633)
#12 0x00007f71df167633 clang::Parser::SkipUntil(llvm::ArrayRef<clang::tok::TokenKind>, clang::Parser::SkipUntilFlags) (/lib64/libclang-cpp.so.18.1+0xb67633)
#13 0x00007f71df167633 clang::Parser::SkipUntil(llvm::ArrayRef<clang::tok::TokenKind>, clang::Parser::SkipUntilFlags) (/lib64/libclang-cpp.so.18.1+0xb67633)
#14 0x00007f71df167633 clang::Parser::SkipUntil(llvm::ArrayRef<clang::tok::TokenKind>, clang::Parser::SkipUntilFlags) (/lib64/libclang-cpp.so.18.1+0xb67633)
#15 0x00007f71df167633 clang::Parser::SkipUntil(llvm::ArrayRef<clang::tok::TokenKind>, clang::Parser::SkipUntilFlags) (/lib64/libclang-cpp.so.18.1+0xb67633)
#16 0x00007f71df167633 clang::Parser::SkipUntil(llvm::ArrayRef<clang::tok::TokenKind>, clang::Parser::SkipUntilFlags) (/lib64/libclang-cpp.so.18.1+0xb67633)
#17 0x00007f71df167633 clang::Parser::SkipUntil(llvm::ArrayRef<clang::tok::TokenKind>, clang::Parser::SkipUntilFlags) (/lib64/libclang-cpp.so.18.1+0xb67633)
#18 0x00007f71df167633 clang::Parser::SkipUntil(llvm::ArrayRef<clang::tok::TokenKind>, clang::Parser::SkipUntilFlags) (/lib64/libclang-cpp.so.18.1+0xb67633)
#19 0x00007f71df167633 clang::Parser::SkipUntil(llvm::ArrayRef<clang::tok::TokenKind>, clang::Parser::SkipUntilFlags) (/lib64/libclang-cpp.so.18.1+0xb67633)
#20 0x00007f71df167633 clang::Parser::SkipUntil(llvm::ArrayRef<clang::tok::TokenKind>, clang::Parser::SkipUntilFlags) (/lib64/libclang-cpp.so.18.1+0xb67633)
#21 0x00007f71df167633 clang::Parser::SkipUntil(llvm::ArrayRef<clang::tok::TokenKind>, clang::Parser::SkipUntilFlags) (/lib64/libclang-cpp.so.18.1+0xb67633)
#22 0x00007f71df167633 clang::Parser::SkipUntil(llvm::ArrayRef<clang::tok::TokenKind>, clang::Parser::SkipUntilFlags) (/lib64/libclang-cpp.so.18.1+0xb67633)
#23 0x00007f71df167633 clang::Parser::SkipUntil(llvm::ArrayRef<clang::tok::TokenKind>, clang::Parser::SkipUntilFlags) (/lib64/libclang-cpp.so.18.1+0xb67633)
#24 0x00007f71df167633 clang::Parser::SkipUntil(llvm::ArrayRef<clang::tok::TokenKind>, clang::Parser::SkipUntilFlags) (/lib64/libclang-cpp.so.18.1+0xb67633)
#25 0x00007f71df167633 clang::Parser::SkipUntil(llvm::ArrayRef<clang::tok::TokenKind>, clang::Parser::SkipUntilFlags) (/lib64/libclang-cpp.so.18.1+0xb67633)
#26 0x00007f71df167633 clang::Parser::SkipUntil(llvm::ArrayRef<clang::tok::TokenKind>, clang::Parser::SkipUntilFlags) (/lib64/libclang-cpp.so.18.1+0xb67633)
#27 0x00007f71df0a6798 clang::Parser::SkipMalformedDecl() (/lib64/libclang-cpp.so.18.1+0xaa6798)
#28 0x00007f71df0a5790 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/lib64/libclang-cpp.so.18.1+0xaa5790)
#29 0x00007f71df16c5e7 clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/lib64/libclang-cpp.so.18.1+0xb6c5e7)
#30 0x00007f71df16bf98 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/lib64/libclang-cpp.so.18.1+0xb6bf98)
#31 0x00007f71df16b004 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/lib64/libclang-cpp.so.18.1+0xb6b004)
#32 0x00007f71df169225 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/lib64/libclang-cpp.so.18.1+0xb69225)
#33 0x00007f71df08ec6c clang::ParseAST(clang::Sema&, bool, bool) (/lib64/libclang-cpp.so.18.1+0xa8ec6c)
#34 0x00007f71e132a756 clang::FrontendAction::Execute() (/lib64/libclang-cpp.so.18.1+0x2d2a756)
#35 0x00007f71e129d1b4 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/lib64/libclang-cpp.so.18.1+0x2c9d1b4)
#36 0x00007f71e13a5e36 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/lib64/libclang-cpp.so.18.1+0x2da5e36)
#37 0x000055ea0d0a6660 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/bin/clang-18+0x12660)
#38 0x000055ea0d0a33a8 (/usr/bin/clang-18+0xf3a8)
#39 0x000055ea0d0a20fb clang_main(int, char**, llvm::ToolContext const&) (/usr/bin/clang-18+0xe0fb)
#40 0x000055ea0d0af6e9 main (/usr/bin/clang-18+0x1b6e9)
#41 0x00007f71d6a2a1f0 __libc_start_call_main (/lib64/libc.so.6+0x2a1f0)
#42 0x00007f71d6a2a2b9 __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x2a2b9)
#43 0x000055ea0d09fb25 _start (/usr/bin/clang-18+0xbb25)
clang++: error: unable to execute command: Segmentation fault (core dumped)
clang++: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 18.1.4
Target: x86_64-suse-linux
Thread model: posix
InstalledDir: /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: /tmp/test-d4937e.cpp
clang++: note: diagnostic msg: /tmp/test-d4937e.sh
clang++: note: diagnostic msg: 

********************
```
The preprocessed file and associated run script are attached to this issue, with a `.txt` suffix for me to be able to submit them to GitHub.
[test-d4937e.cpp.txt](https://github.com/llvm/llvm-project/files/15203846/test-d4937e.cpp.txt)
[test-d4937e.sh.txt](https://github.com/llvm/llvm-project/files/15203855/test-d4937e.sh.txt)

_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to