https://llvm.org/bugs/show_bug.cgi?id=27342
Bug ID: 27342 Summary: Segfault with function SFINAE in valid code Product: clang Version: 3.4 Hardware: PC OS: Linux Status: NEW Severity: normal Priority: P Component: C++11 Assignee: unassignedclangb...@nondot.org Reporter: jacquelinek...@gmail.com CC: dgre...@apple.com, llvm-bugs@lists.llvm.org Classification: Unclassified With Clang 3.4-1 (on Ubuntu 14.04), Clang segfaults in a valid use of function SFINAE (it compiles with gcc). To summarize: class Foo inherits from pure virtual FooVirtual. Foo is templated on the callback type of a function that it stores. Two function types are allowed via enable_if, a void signature and a signature with a Foo&. FooFactory instantiates a shared pointer of Foo with create_foo(callback). In main, if FooFactory::create_foo(callback) is called with the void specialization and callback as a local lambda with a capture list, Clang segfaults. Please let me know if this issue can be patched, or if it is fixed in 3.5. This use case is a requirement for my project. source of MWE can be found here: https://gist.github.com/jacquelinekay/ef45d875a9cfbcda1e85db27b296cf1b Bug report artifacts: Preprocessed source (raw): https://gist.githubusercontent.com/jacquelinekay/2a86c34b83579e899d6c85d97907b849/raw/0d0825a4b98d6e6e1ea6a25df307a4284d8faa22/clang_segfault-3db907.cpp Run script (raw): https://gist.githubusercontent.com/jacquelinekay/1423a4f3376d742bbd2ba3a038b63dad/raw/8c8a7a046e7b6face415476715c53dfc461738c2/clang_segfault-3db907.sh Backtrace/stack dump: clang++ clang_sfinae_segfault.cpp -std=c++11 0 libLLVM-3.4.so.1 0x00007f3d4980d5d2 llvm::sys::PrintStackTrace(_IO_FILE*) + 34 1 libLLVM-3.4.so.1 0x00007f3d4980d3c4 2 libpthread.so.0 0x00007f3d48712340 3 clang 0x000000000062f1ba 4 clang 0x0000000000630c2b 5 clang 0x00000000010f2e53 clang::Stmt::printPretty(llvm::raw_ostream&, clang::PrinterHelper*, clang::PrintingPolicy const&, unsigned int) const + 643 6 clang 0x0000000001005a39 7 clang 0x00000000010055f1 8 clang 0x00000000010055f1 9 clang 0x00000000010075f6 10 clang 0x0000000001008b69 clang::FormatASTNodeDiagnosticArgument(clang::DiagnosticsEngine::ArgumentKind, long, char const*, unsigned int, char const*, unsigned int, std::pair<clang::DiagnosticsEngine::ArgumentKind, long> const*, unsigned int, llvm::SmallVectorImpl<char>&, void*, llvm::ArrayRef<long>) + 681 11 clang 0x0000000001139ddf clang::Diagnostic::FormatDiagnostic(char const*, char const*, llvm::SmallVectorImpl<char>&) const + 1199 12 clang 0x000000000069cfd7 clang::TextDiagnosticPrinter::HandleDiagnostic(clang::DiagnosticsEngine::Level, clang::Diagnostic const&) + 87 13 clang 0x000000000113c890 clang::DiagnosticIDs::EmitDiag(clang::DiagnosticsEngine&, clang::DiagnosticIDs::Level) const + 48 14 clang 0x000000000113cafe clang::DiagnosticIDs::ProcessDiag(clang::DiagnosticsEngine&) const + 382 15 clang 0x00000000011365cc clang::DiagnosticsEngine::EmitCurrentDiagnostic(bool) + 76 16 clang 0x00000000009a9375 clang::Sema::EmitCurrentDiagnostic(unsigned int) + 837 17 clang 0x00000000009af17f 18 clang 0x0000000000b63723 clang::InitializationSequence::Diagnose(clang::Sema&, clang::InitializedEntity const&, clang::InitializationKind const&, llvm::ArrayRef<clang::Expr*>) + 6611 19 clang 0x0000000000b581a5 clang::InitializationSequence::Perform(clang::Sema&, clang::InitializedEntity const&, clang::InitializationKind const&, llvm::MutableArrayRef<clang::Expr*>, clang::QualType*) + 7413 20 clang 0x0000000000b5b9e9 clang::Sema::PerformCopyInitialization(clang::InitializedEntity const&, clang::SourceLocation, clang::ActionResult<clang::Expr*, true>, bool, bool) + 249 21 clang 0x0000000000bd0b9c clang::Sema::PerformMoveOrCopyInitialization(clang::InitializedEntity const&, clang::VarDecl const*, clang::QualType, clang::Expr*, bool) + 76 22 clang 0x0000000000bd34db clang::Sema::ActOnReturnStmt(clang::SourceLocation, clang::Expr*) + 827 23 clang 0x0000000000c4ea12 24 clang 0x0000000000c606c5 25 clang 0x0000000000c611aa 26 clang 0x0000000000c612db 27 clang 0x0000000000c60805 28 clang 0x0000000000c633ef clang::Sema::SubstStmt(clang::Stmt*, clang::MultiLevelTemplateArgumentList const&) + 79 29 clang 0x0000000000c789ee clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation, clang::FunctionDecl*, bool, bool) + 2702 30 clang 0x0000000000c77d7b clang::Sema::PerformPendingInstantiations(bool) + 491 31 clang 0x00000000009ab73e clang::Sema::ActOnEndOfTranslationUnit() + 350 32 clang 0x000000000092b6bb clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 379 33 clang 0x000000000092276b clang::ParseAST(clang::Sema&, bool, bool) + 283 34 clang 0x0000000000671149 clang::FrontendAction::Execute() + 169 35 clang 0x0000000000651a75 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 293 36 clang 0x000000000063c9b6 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1638 37 clang 0x0000000000638788 cc1_main(char const**, char const**, char const*, void*) + 1176 38 clang 0x0000000000636fff main + 7519 39 libc.so.6 0x00007f3d47e44ec5 __libc_start_main + 245 40 clang 0x00000000006377ef Stack dump: 0. Program arguments: /usr/bin/clang -cc1 -triple x86_64-pc-linux-gnu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name clang_segfault.cpp -mrelocation-model static -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -target-linker-version 2.24 -resource-dir /usr/bin/../lib/clang/3.4 -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8 -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/x86_64-linux-gnu -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/backward -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/x86_64-linux-gnu/c++/4.8 -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/clang/3.4/include -internal-externc-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -std=c++11 -fdeprecated-macro -fdebug-compilation-dir /tmp -ferror-limit 19 -fmessage-length 113 -mstackrealign -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -vectorize-slp -o /tmp/clang_segfault-18865a.o -x c++ clang_segfault.cpp 1. <eof> parser at end of file 2. clang_segfault.cpp:68:3: instantiating function definition 'create_wall_timer' clang: error: unable to execute command: Segmentation fault (core dumped) clang: error: clang frontend command failed due to signal (use -v to see invocation) Ubuntu clang version 3.4-1ubuntu3 (tags/RELEASE_34/final) (based on LLVM 3.4) Target: x86_64-pc-linux-gnu Thread model: posix -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs