Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clang crash #555

Closed
tdauth opened this issue Mar 3, 2017 · 4 comments
Closed

Clang crash #555

tdauth opened this issue Mar 3, 2017 · 4 comments

Comments

@tdauth
Copy link

tdauth commented Mar 3, 2017

Actually it is a bug in Clang, I guess but I cannot register at https://bugs.llvm.org/enter_bug.cgi anymore and maybe this helps you anyway.

Scanning dependencies of target futuresfolly
[ 81%] Building CXX object folly/CMakeFiles/futuresfolly.dir/folly.cpp.o
#0 0x7ff3131b8327 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/usr/lib64/llvm/libLLVM-3.7.so+0x510327)
#1 0x7ff3131b7881 (/usr/lib64/llvm/libLLVM-3.7.so+0x50f881)
#2 0x7ff312884a00 __restore_rt (/lib64/libpthread.so.0+0x10a00)
#3 0x55c95ebbb94d (/usr/bin/clang+0x10e894d)
#4 0x55c95ebc2f8f (/usr/bin/clang+0x10eff8f)
#5 0x55c95ebc330e (/usr/bin/clang+0x10f030e)
#6 0x55c95ebc1b93 (/usr/bin/clang+0x10eeb93)
#7 0x55c95ebc1aed (/usr/bin/clang+0x10eeaed)
#8 0x55c95ebc283b (/usr/bin/clang+0x10ef83b)
#9 0x55c95ebc2bb8 (/usr/bin/clang+0x10efbb8)
#10 0x55c95ebc6029 (/usr/bin/clang+0x10f3029)
#11 0x55c95ebbca93 (/usr/bin/clang+0x10e9a93)
#12 0x55c95ebbe13f (/usr/bin/clang+0x10eb13f)
#13 0x55c95ebbff1d (/usr/bin/clang+0x10ecf1d)
#14 0x55c95ebbfdfd (/usr/bin/clang+0x10ecdfd)
#15 0x55c95ebc0118 (/usr/bin/clang+0x10ed118)
#16 0x55c95ebc58d7 (/usr/bin/clang+0x10f28d7)
#17 0x55c95e0e52a9 clang::CodeGen::CodeGenModule::getMangledName(clang::GlobalDecl) (/usr/bin/clang+0x6122a9)
#18 0x55c95e0f0ec3 clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) (/usr/bin/clang+0x61dec3)
#19 0x55c95e0f1918 clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (/usr/bin/clang+0x61e918)
#20 0x55c95e076e0f (/usr/bin/clang+0x5a3e0f)
#21 0x55c95e064074 (/usr/bin/clang+0x591074)
#22 0x55c95e6a9315 clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation, clang::FunctionDecl*, bool, bool) (/usr/bin/clang+0xbd6315)
#23 0x55c95e6a9bfb clang::Sema::PerformPendingInstantiations(bool) (/usr/bin/clang+0xbd6bfb)
#24 0x55c95e6a9347 clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation, clang::FunctionDecl*, bool, bool) (/usr/bin/clang+0xbd6347)
#25 0x55c95e6a9bfb clang::Sema::PerformPendingInstantiations(bool) (/usr/bin/clang+0xbd6bfb)
#26 0x55c95e6a9347 clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation, clang::FunctionDecl*, bool, bool) (/usr/bin/clang+0xbd6347)
#27 0x55c95e6a9bfb clang::Sema::PerformPendingInstantiations(bool) (/usr/bin/clang+0xbd6bfb)
#28 0x55c95e6a9347 clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation, clang::FunctionDecl*, bool, bool) (/usr/bin/clang+0xbd6347)
#29 0x55c95e6a9bfb clang::Sema::PerformPendingInstantiations(bool) (/usr/bin/clang+0xbd6bfb)
#30 0x55c95e6a9347 clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation, clang::FunctionDecl*, bool, bool) (/usr/bin/clang+0xbd6347)
#31 0x55c95e6a9bfb clang::Sema::PerformPendingInstantiations(bool) (/usr/bin/clang+0xbd6bfb)
#32 0x55c95e31099a clang::Sema::ActOnEndOfTranslationUnit() (/usr/bin/clang+0x83d99a)
#33 0x55c95e25f118 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) (/usr/bin/clang+0x78c118)
#34 0x55c95e25431b clang::ParseAST(clang::Sema&, bool, bool) (/usr/bin/clang+0x78131b)
#35 0x55c95e064d81 clang::CodeGenAction::ExecuteAction() (/usr/bin/clang+0x591d81)
#36 0x55c95deae4ce clang::FrontendAction::Execute() (/usr/bin/clang+0x3db4ce)
#37 0x55c95de81381 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/bin/clang+0x3ae381)
#38 0x55c95de67ae1 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/bin/clang+0x394ae1)
#39 0x55c95de612b8 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/bin/clang+0x38e2b8)
#40 0x55c95de5dbf2 main (/usr/bin/clang+0x38abf2)
#41 0x7ff31174d580 __libc_start_main (/lib64/libc.so.6+0x20580)
#42 0x55c95de60179 _start (/usr/bin/clang+0x38d179)
Stack dump:
compiling folly.cpp (clang)
1.	<eof> parser at end of file
2.	/home/tamino/thesis/futures/build/folly/folly-prefix/src/folly/folly/futures/Future-inl.h:1365:1: instantiating function definition 'retryingPolicyCappedJitteredExponentialBackoff'
3.	/home/tamino/thesis/futures/build/folly/folly-prefix/src/folly/folly/futures/Future-inl.h:1308:1: instantiating function definition 'retryingPolicyCappedJitteredExponentialBackoff'
4.	/home/tamino/thesis/futures/build/folly/folly-prefix/src/folly/folly/futures/Future-inl.h:1275:1: instantiating function definition 'retryingPolicyCappedJitteredExponentialBackoff'
5.	/home/tamino/thesis/futures/build/folly/folly-prefix/src/folly/folly/futures/Future.h:193:22: instantiating function definition 'then'
6.	/home/tamino/thesis/futures/build/folly/folly-prefix/src/folly/folly/futures/Future.h:495:3: instantiating function definition 'thenImplementation'
7.	/home/tamino/thesis/futures/build/folly/folly-prefix/src/folly/folly/futures/Future.h:495:3: LLVM IR generation of declaration 'folly::Future<folly::Unit>::thenImplementation'
8.	/home/tamino/thesis/futures/build/folly/folly-prefix/src/folly/folly/futures/Future.h:495:3: Mangling declaration 'folly::Future<folly::Unit>::thenImplementation'
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 3.7.0 (tags/RELEASE_370/final)
Target: x86_64-redhat-linux-gnu
Thread model: posix
clang: note: diagnostic msg: PLEASE submit a bug report to http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and associated run script.
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/folly-ef0157.cpp
clang: note: diagnostic msg: /tmp/folly-ef0157.sh
clang: note: diagnostic msg: 

********************

I am building folly in CMake using this CMakeLists.txt:

include(ExternalProject)

ExternalProject_Add(
    gtest
    GIT_REPOSITORY https://github.com/google/googletest.git
    INSTALL_COMMAND "" # Disable install step
    UPDATE_COMMAND "" # Doesn't change often
    #CONFIGURE_COMMAND "" # skip
    #BUILD_COMMAND "" # skip
    LOG_DOWNLOAD ON
    LOG_CONFIGURE ON
    LOG_BUILD ON
)

# See https://github.com/facebook/folly/blob/master/README.md for all dependencies which have to be installed on Fedora as well.
find_package(gflags REQUIRED)
#find_package(glog REQUIRED)

set(folly_DIR "${CMAKE_BINARY_DIR}/folly/folly-prefix/src/folly/folly")
set(folly_LIB_DIR "${CMAKE_BINARY_DIR}/folly")

ExternalProject_Add(folly
GIT_REPOSITORY https://github.com/facebook/folly
GIT_TAG "v2016.12.19.00" # use a stable version
INSTALL_COMMAND ""
# CC="/usr/bin/clang" CXX="/usr/bin/clang++"
CONFIGURE_COMMAND cd "${folly_DIR}" && autoreconf -ivf && ./configure #--prefix="${folly_LIB_DIR}"
BUILD_COMMAND cd "${folly_DIR}" && make -j4
DEPENDS gtest
)

include_directories("${folly_DIR}/futures/" "${CMAKE_BINARY_DIR}/folly/folly-prefix/src/folly")
link_directories("${folly_LIB_DIR}")

add_executable(futuresfolly folly.cpp)

I've tried it without the GIT_TAG specification as well. Even if it is a Clang bug maybe something could be done about it. I am using Fedora and the installed Clang package. If there would be an official folly-dev package, I would use it instead.

@tdauth
Copy link
Author

tdauth commented Mar 3, 2017

Here is a 7zip archive of the two files /tmp/folly-ef0157.cpp and /tmp/folly-ef0157.sh:
folly.zip

@igorsugak
Copy link
Contributor

Would you try revering locally the following change and see if it helps?

1d804f0

@tdauth
Copy link
Author

tdauth commented Mar 10, 2017

Hasn't this commit been done after v2016.12.19.00?

edit:
I am trying an older version now: v2016.10.24.00

Apparently g++ is still used:
libtool: compile: g++ -DHAVE_CONFIG_H -I./.. -pthread -I/usr/include -std=gnu++1y -g -O2 -MT io/async/Request.lo -MD -MP -MF io/async/.deps/Request.Tpo -c io/async/Request.cpp -fPIC -DPIC -o io/async/.libs/Request.o

My calls are:

CONFIGURE_COMMAND CC="/usr/bin/clang" CXX="/usr/bin/clang++" cd "${folly_DIR}" && autoreconf -ivf && ./configure #--prefix="${folly_LIB_DIR}"
BUILD_COMMAND cd "${folly_DIR}" && make -j4

but it seems to use Clang only when CMAKE_CXX_COMPILER and CMAKE_C_COMPILER of my project are set to it. The CC="" and CXX="" calls are ignored? How do I specify clang successfully for autoreconf? Maybe it mixes up two compilers.

edit2:
Found the answer here http://stackoverflow.com/questions/32342886/how-to-configure-autoreconf-to-use-a-different-compiler-than-gcc
Trying it again with only Clang now.

edit3:
My CXXFLAGS seem to be appended only and I had to add -msse4.2 to prevent errors:
libtool: compile: clang++ -DHAVE_CONFIG_H -I./.. -pthread -I/usr/include -std=gnu++1y -std=c++14 -msse4.2 -MT Assume.lo -MD -MP -MF .deps/Assume.Tpo -c Assume.cpp -fPIC -DPIC -o .libs/Assume.o

This is my call now:

autoreconf -ivf
./configure CC=clang CXX=clang++ CFLAGS=-std=c11 CXXFLAGS='-std=c++14 -msse4.2'

I am getting another crash of Clang now which shows the actual clang call:

Stack dump:
0.      Program arguments: /usr/bin/clang -cc1 -triple x86_64-redhat-linux-gnu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name Barrier.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -target-feature +sse4.2 -target-linker-version 2.25 -dwarf-column-info -coverage-file /home/tamino/thesis/futures/build/folly/folly-prefix/src/folly/folly/futures/.libs/Barrier.o -resource-dir /usr/bin/../lib/clang/3.7.0 -dependency-file futures/.deps/Barrier.Tpo -sys-header-deps -MP -MT futures/Barrier.lo -D HAVE_CONFIG_H -D PIC -I ./.. -I /usr/include -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/5.3.1/../../../../include/c++/5.3.1 -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/5.3.1/../../../../include/c++/5.3.1/x86_64-redhat-linux -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/5.3.1/../../../../include/c++/5.3.1/backward -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/clang/3.7.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -std=c++14 -fdeprecated-macro -fdebug-compilation-dir /home/tamino/thesis/futures/build/folly/folly-prefix/src/folly/folly -ferror-limit 19 -fmessage-length 238 -pthread -mstackrealign -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o futures/.libs/Barrier.o -x c++ futures/Barrier.cpp 
1.      <eof> parser at end of file
2.      ./../folly/futures/Future-inl.h:1373:1: instantiating function definition 'retryingPolicyCappedJitteredExponentialBackoff'
3.      ./../folly/futures/Future-inl.h:1316:1: instantiating function definition 'retryingPolicyCappedJitteredExponentialBackoff'
4.      ./../folly/futures/Future-inl.h:1283:1: instantiating function definition 'retryingPolicyCappedJitteredExponentialBackoff'
5.      ./../folly/futures/Future.h:181:22: instantiating function definition 'then'
6.      ./../folly/futures/Future.h:483:3: instantiating function definition 'thenImplementation'
7.      ./../folly/futures/Future.h:483:3: LLVM IR generation of declaration 'folly::Future<folly::Unit>::thenImplementation'
8.      ./../folly/futures/Future.h:483:3: Mangling declaration 'folly::Future<folly::Unit>::thenImplementation'
#0 0x7f248e719327 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/usr/lib64/llvm/libLLVM-3.7.so+0x510327)
#1 0x7f248e718881 (/usr/lib64/llvm/libLLVM-3.7.so+0x50f881)
#2 0x7f248dde5a00 __restore_rt (/lib64/libpthread.so.0+0x10a00)
#3 0x56293695f94d (/usr/bin/clang+0x10e894d)
#4 0x562936966f8f (/usr/bin/clang+0x10eff8f)
#5 0x56293696730e (/usr/bin/clang+0x10f030e)
#6 0x562936965b93 (/usr/bin/clang+0x10eeb93)
#7 0x562936965aed (/usr/bin/clang+0x10eeaed)
#8 0x56293696683b (/usr/bin/clang+0x10ef83b)
#9 0x562936966bb8 (/usr/bin/clang+0x10efbb8)
#10 0x56293696a029 (/usr/bin/clang+0x10f3029)
#11 0x562936960a93 (/usr/bin/clang+0x10e9a93)
#12 0x56293696213f (/usr/bin/clang+0x10eb13f)
#13 0x562936963f1d (/usr/bin/clang+0x10ecf1d)
#14 0x562936963dfd (/usr/bin/clang+0x10ecdfd)
#15 0x562936964118 (/usr/bin/clang+0x10ed118)
#16 0x5629369698d7 (/usr/bin/clang+0x10f28d7)
#17 0x562935e892a9 clang::CodeGen::CodeGenModule::getMangledName(clang::GlobalDecl) (/usr/bin/clang+0x6122a9)
#18 0x562935e94ec3 clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) (/usr/bin/clang+0x61dec3)
#19 0x562935e95918 clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (/usr/bin/clang+0x61e918)
#20 0x562935e1ae0f (/usr/bin/clang+0x5a3e0f)
#21 0x562935e08074 (/usr/bin/clang+0x591074)
#22 0x56293644d315 clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation, clang::FunctionDecl*, bool, bool) (/usr/bin/clang+0xbd6315)
#23 0x56293644dbfb clang::Sema::PerformPendingInstantiations(bool) (/usr/bin/clang+0xbd6bfb)
#24 0x56293644d347 clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation, clang::FunctionDecl*, bool, bool) (/usr/bin/clang+0xbd6347)
#25 0x56293644dbfb clang::Sema::PerformPendingInstantiations(bool) (/usr/bin/clang+0xbd6bfb)
#26 0x56293644d347 clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation, clang::FunctionDecl*, bool, bool) (/usr/bin/clang+0xbd6347)
#27 0x56293644dbfb clang::Sema::PerformPendingInstantiations(bool) (/usr/bin/clang+0xbd6bfb)
#28 0x56293644d347 clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation, clang::FunctionDecl*, bool, bool) (/usr/bin/clang+0xbd6347)
#29 0x56293644dbfb clang::Sema::PerformPendingInstantiations(bool) (/usr/bin/clang+0xbd6bfb)
#30 0x56293644d347 clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation, clang::FunctionDecl*, bool, bool) (/usr/bin/clang+0xbd6347)
#31 0x56293644dbfb clang::Sema::PerformPendingInstantiations(bool) (/usr/bin/clang+0xbd6bfb)
#32 0x5629360b499a clang::Sema::ActOnEndOfTranslationUnit() (/usr/bin/clang+0x83d99a)
#33 0x562936003118 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) (/usr/bin/clang+0x78c118)
#34 0x562935ff831b clang::ParseAST(clang::Sema&, bool, bool) (/usr/bin/clang+0x78131b)
#35 0x562935e08d81 clang::CodeGenAction::ExecuteAction() (/usr/bin/clang+0x591d81)
#36 0x562935c524ce clang::FrontendAction::Execute() (/usr/bin/clang+0x3db4ce)
#37 0x562935c25381 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/bin/clang+0x3ae381)
#38 0x562935c0bae1 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/bin/clang+0x394ae1)
#39 0x562935c052b8 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/bin/clang+0x38e2b8)
#40 0x562935c01bf2 main (/usr/bin/clang+0x38abf2)
#41 0x7f248ccae580 __libc_start_main (/lib64/libc.so.6+0x20580)
#42 0x562935c04179 _start (/usr/bin/clang+0x38d179)

@Orvid
Copy link
Contributor

Orvid commented Sep 20, 2018

I believe this has been resolved upstream in Clang, as we've not had more reports of this issue in the last year.

@Orvid Orvid closed this as completed Sep 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants