Uploaded image for project: 'ROOT'
  1. ROOT
  2. ROOT-7172

MIsleading diagnostic and crash when executing named macro

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: 6.04.00
    • Fix Version/s: 6.10/00
    • Component/s: Cling
    • Labels:
      None
    • Environment:

      linux/osx

    • Development:

      Description

      When running this macro (created to test thread safety of fits), misleading diagnostics and a crash occur. This is due to the incomplete "int declaration" in the for loop in the lambda function:

      void misleadingDiag(){
         TThread::Initialize();
         TH1::AddDirectory(kFALSE);
         ROOT::Math::MinimizerOptions::SetDefaultMinimizer("Minuit2");
         vector<thread> threads;
         TRandom3 rndm;
         for (int i=0;i<5;++i){
            auto f = [&](){
               TH1F h("h","h",100,-1,1);
               for (/*int*/ j=0;j<100;++j){
                  h.Fill(rndm.Gaus(-1,1));
               }
               h.Fit("gaus");
            };
            threads.emplace_back(f);
         }
         for (auto&& t : threads) t.join();
      }

      The output produced is

      Processing misleadingDiag.C...
      warning: expression result unused [-Wunused-value]
       
       *** Break *** segmentation violation
       
       
       
      ===========================================================
      There was a crash (kSigSegmentationViolation).
      This is the entire stack trace of all threads:
      ===========================================================
      #0  0x00007fa3c17fd6dc in __libc_waitpid (pid=1817, stat_loc=stat_loc
      entry=0x7fff62d23710, options=options
      entry=0) at ../sysdeps/unix/sysv/linux/waitpid.c:31
      #1  0x00007fa3c17822e2 in do_system (line=<optimized out>) at ../sysdeps/posix/system.c:148
      #2  0x00007fa3c2fcd009 in TUnixSystem::Exec (this=0x7fa3c082d300, shellcmd=0x7fa3b4496800 "/ssd/RootDevel/Root6/head/buildClang/etc/gdb-backtrace.sh 1796 1>&2") at /home/dpiparo/RootDevel/Root6/head/root/core/unix/src/TUnixSystem.cxx:2069
      #3  0x00007fa3c2fcdbe5 in TUnixSystem::StackTrace (this=0x7fa3c082d300) at /home/dpiparo/RootDevel/Root6/head/root/core/unix/src/TUnixSystem.cxx:2297
      #4  0x00007fa3c2fd3729 in TUnixSystem::DispatchSignals (this=0x7fa3c082d300, sig=kSigSegmentationViolation) at /home/dpiparo/RootDevel/Root6/head/root/core/unix/src/TUnixSystem.cxx:3535
      #5  0x00007fa3c2fc7ea4 in SigHandler (sig=kSigSegmentationViolation) at /home/dpiparo/RootDevel/Root6/head/root/core/unix/src/TUnixSystem.cxx:395
      #6  0x00007fa3c2fd38f7 in sighandler (sig=11) at /home/dpiparo/RootDevel/Root6/head/root/core/unix/src/TUnixSystem.cxx:3512
      #7  0x00007fa3c2fc76c6 in textinput::TerminalConfigUnix::HandleSignal (this=0x7fa3c3346cd8 <textinput::TerminalConfigUnix::Get()::s>, signum=11) at /home/dpiparo/RootDevel/Root6/head/root/core/textinput/src/textinput/TerminalConfigUnix.cpp:96
      #8  0x00007fa3c2fc74bb in (anonymous namespace)::TerminalConfigUnix__handleSignal (signum=11) at /home/dpiparo/RootDevel/Root6/head/root/core/textinput/src/textinput/TerminalConfigUnix.cpp:36
      #9  <signal handler called>
      #10 0x00007fa3bf769c0d in llvm::LoadInst::LoadInst(llvm::Value*, char const*, bool, llvm::Instruction*) () from /ssd/RootDevel/Root6/head/buildClang/lib/libCling.so
      #11 0x00007fa3be8de0f5 in llvm::IRBuilder<false, llvm::ConstantFolder, clang::CodeGen::CGBuilderInserter<false> >::CreateLoad(llvm::Value*, llvm::Twine const&) () from /ssd/RootDevel/Root6/head/buildClang/lib/libCling.so
      #12 0x00007fa3be9b0fe5 in clang::CodeGen::CodeGenFunction::EmitLoadOfScalar(llvm::Value*, bool, unsigned int, clang::QualType, clang::SourceLocation, llvm::MDNode*, clang::QualType, unsigned long) () from /ssd/RootDevel/Root6/head/buildClang/lib/libCling.so
      #13 0x00007fa3be9b26a7 in clang::CodeGen::CodeGenFunction::EmitLoadOfLValue(clang::CodeGen::LValue, clang::SourceLocation) () from /ssd/RootDevel/Root6/head/buildClang/lib/libCling.so
      #14 0x00007fa3be9d18a3 in clang::StmtVisitorBase<clang::make_ptr, (anonymous namespace)::ScalarExprEmitter, llvm::Value*>::Visit(clang::Stmt*) () from /ssd/RootDevel/Root6/head/buildClang/lib/libCling.so
      #15 0x00007fa3be9d6985 in (anonymous namespace)::ScalarExprEmitter::VisitCastExpr(clang::CastExpr*) () from /ssd/RootDevel/Root6/head/buildClang/lib/libCling.so
      #16 0x00007fa3be9d86ae in (anonymous namespace)::ScalarExprEmitter::EmitCompare(clang::BinaryOperator const*, unsigned int, unsigned int, unsigned int) () from /ssd/RootDevel/Root6/head/buildClang/lib/libCling.so
      #17 0x00007fa3be9c8ae6 in clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) () from /ssd/RootDevel/Root6/head/buildClang/lib/libCling.so
      #18 0x00007fa3be9a6b26 in clang::CodeGen::CodeGenFunction::EvaluateExprAsBool(clang::Expr const*) () from /ssd/RootDevel/Root6/head/buildClang/lib/libCling.so
      #19 0x00007fa3be8d7a9d in clang::CodeGen::CodeGenFunction::EmitForStmt(clang::ForStmt const&, llvm::ArrayRef<clang::Attr const*>) () from /ssd/RootDevel/Root6/head/buildClang/lib/libCling.so
      #20 0x00007fa3be8d5f7d in clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*) () from /ssd/RootDevel/Root6/head/buildClang/lib/libCling.so
      #21 0x00007fa3be8dc72b in clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) () from /ssd/RootDevel/Root6/head/buildClang/lib/libCling.so
      #22 0x00007fa3be8f0b22 in clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) () from /ssd/RootDevel/Root6/head/buildClang/lib/libCling.so
      #23 0x00007fa3be8fdc12 in clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) () from /ssd/RootDevel/Root6/head/buildClang/lib/libCling.so
      #24 0x00007fa3be8fae7c in clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) () from /ssd/RootDevel/Root6/head/buildClang/lib/libCling.so
      #25 0x00007fa3be8f68d1 in clang::CodeGen::CodeGenModule::EmitDeferred() () from /ssd/RootDevel/Root6/head/buildClang/lib/libCling.so
      #26 0x00007fa3be8f68f9 in clang::CodeGen::CodeGenModule::EmitDeferred() () from /ssd/RootDevel/Root6/head/buildClang/lib/libCling.so
      #27 0x00007fa3be8f68f9 in clang::CodeGen::CodeGenModule::EmitDeferred() () from /ssd/RootDevel/Root6/head/buildClang/lib/libCling.so
      #28 0x00007fa3be8f68f9 in clang::CodeGen::CodeGenModule::EmitDeferred() () from /ssd/RootDevel/Root6/head/buildClang/lib/libCling.so
      #29 0x00007fa3be8f68f9 in clang::CodeGen::CodeGenModule::EmitDeferred() () from /ssd/RootDevel/Root6/head/buildClang/lib/libCling.so
      #30 0x00007fa3be8f68f9 in clang::CodeGen::CodeGenModule::EmitDeferred() () from /ssd/RootDevel/Root6/head/buildClang/lib/libCling.so
      #31 0x00007fa3be8f68f9 in clang::CodeGen::CodeGenModule::EmitDeferred() () from /ssd/RootDevel/Root6/head/buildClang/lib/libCling.so
      #32 0x00007fa3be8f68f9 in clang::CodeGen::CodeGenModule::EmitDeferred() () from /ssd/RootDevel/Root6/head/buildClang/lib/libCling.so
      #33 0x00007fa3be8f68f9 in clang::CodeGen::CodeGenModule::EmitDeferred() () from /ssd/RootDevel/Root6/head/buildClang/lib/libCling.so
      #34 0x00007fa3be8f68f9 in clang::CodeGen::CodeGenModule::EmitDeferred() () from /ssd/RootDevel/Root6/head/buildClang/lib/libCling.so
      #35 0x00007fa3be8f68f9 in clang::CodeGen::CodeGenModule::EmitDeferred() () from /ssd/RootDevel/Root6/head/buildClang/lib/libCling.so
      #36 0x00007fa3be8f68f9 in clang::CodeGen::CodeGenModule::EmitDeferred() () from /ssd/RootDevel/Root6/head/buildClang/lib/libCling.so
      #37 0x00007fa3be8f68f9 in clang::CodeGen::CodeGenModule::EmitDeferred() () from /ssd/RootDevel/Root6/head/buildClang/lib/libCling.so
      #38 0x00007fa3be8f68f9 in clang::CodeGen::CodeGenModule::EmitDeferred() () from /ssd/RootDevel/Root6/head/buildClang/lib/libCling.so
      #39 0x00007fa3be8f68f9 in clang::CodeGen::CodeGenModule::EmitDeferred() () from /ssd/RootDevel/Root6/head/buildClang/lib/libCling.so
      #40 0x00007fa3be8f68f9 in clang::CodeGen::CodeGenModule::EmitDeferred() () from /ssd/RootDevel/Root6/head/buildClang/lib/libCling.so
      #41 0x00007fa3be8f68f9 in clang::CodeGen::CodeGenModule::EmitDeferred() () from /ssd/RootDevel/Root6/head/buildClang/lib/libCling.so
      #42 0x00007fa3be8f68f9 in clang::CodeGen::CodeGenModule::EmitDeferred() () from /ssd/RootDevel/Root6/head/buildClang/lib/libCling.so
      #43 0x00007fa3be8f68f9 in clang::CodeGen::CodeGenModule::EmitDeferred() () from /ssd/RootDevel/Root6/head/buildClang/lib/libCling.so
      #44 0x00007fa3be8f68f9 in clang::CodeGen::CodeGenModule::EmitDeferred() () from /ssd/RootDevel/Root6/head/buildClang/lib/libCling.so
      #45 0x00007fa3be8f68f9 in clang::CodeGen::CodeGenModule::EmitDeferred() () from /ssd/RootDevel/Root6/head/buildClang/lib/libCling.so
      #46 0x00007fa3be8f68f9 in clang::CodeGen::CodeGenModule::EmitDeferred() () from /ssd/RootDevel/Root6/head/buildClang/lib/libCling.so
      #47 0x00007fa3be8f68f9 in clang::CodeGen::CodeGenModule::EmitDeferred() () from /ssd/RootDevel/Root6/head/buildClang/lib/libCling.so
      #48 0x00007fa3be8f68f9 in clang::CodeGen::CodeGenModule::EmitDeferred() () from /ssd/RootDevel/Root6/head/buildClang/lib/libCling.so
      #49 0x00007fa3be8f68f9 in clang::CodeGen::CodeGenModule::EmitDeferred() () from /ssd/RootDevel/Root6/head/buildClang/lib/libCling.so
      #50 0x00007fa3be8f68f9 in clang::CodeGen::CodeGenModule::EmitDeferred() () from /ssd/RootDevel/Root6/head/buildClang/lib/libCling.so
      #51 0x00007fa3be8f68f9 in clang::CodeGen::CodeGenModule::EmitDeferred() () from /ssd/RootDevel/Root6/head/buildClang/lib/libCling.so
      #52 0x00007fa3be8f68f9 in clang::CodeGen::CodeGenModule::EmitDeferred() () from /ssd/RootDevel/Root6/head/buildClang/lib/libCling.so
      #53 0x00007fa3be8f64d3 in clang::CodeGen::CodeGenModule::Release() () from /ssd/RootDevel/Root6/head/buildClang/lib/libCling.so
      #54 0x00007fa3be3f8de0 in cling::IncrementalParser::codeGenTransaction(cling::Transaction*) () from /ssd/RootDevel/Root6/head/buildClang/lib/libCling.so
      #55 0x00007fa3be3f8880 in cling::IncrementalParser::commitTransaction(cling::Transaction*) () from /ssd/RootDevel/Root6/head/buildClang/lib/libCling.so
      #56 0x00007fa3be3f953e in cling::IncrementalParser::Compile(llvm::StringRef, cling::CompilationOptions const&) () from /ssd/RootDevel/Root6/head/buildClang/lib/libCling.so
      #57 0x00007fa3be3a7842 in cling::Interpreter::declare(std::string const&, cling::Transaction**) () from /ssd/RootDevel/Root6/head/buildClang/lib/libCling.so
      #58 0x00007fa3be3aad45 in cling::Interpreter::loadFile(std::string const&, bool, cling::Transaction**) () from /ssd/RootDevel/Root6/head/buildClang/lib/libCling.so
      #59 0x00007fa3be4292c0 in cling::MetaSema::actOnLCommand(llvm::StringRef, cling::Transaction**) () from /ssd/RootDevel/Root6/head/buildClang/lib/libCling.so
      #60 0x00007fa3be429bf8 in cling::MetaSema::actOnxCommand(llvm::StringRef, llvm::StringRef, cling::Value*) () from /ssd/RootDevel/Root6/head/buildClang/lib/libCling.so
      #61 0x00007fa3be43739c in cling::MetaParser::isXCommand(cling::MetaSema::ActionResult&, cling::Value*) () from /ssd/RootDevel/Root6/head/buildClang/lib/libCling.so
      #62 0x00007fa3be436a45 in cling::MetaParser::isCommand(cling::MetaSema::ActionResult&, cling::Value*) () from /ssd/RootDevel/Root6/head/buildClang/lib/libCling.so
      #63 0x00007fa3be436835 in cling::MetaParser::isMetaCommand(cling::MetaSema::ActionResult&, cling::Value*) () from /ssd/RootDevel/Root6/head/buildClang/lib/libCling.so
      #64 0x00007fa3be4279a6 in cling::MetaProcessor::process(char const*, cling::Interpreter::CompilationResult&, cling::Value*) () from /ssd/RootDevel/Root6/head/buildClang/lib/libCling.so
      #65 0x00007fa3be24341c in TCling::ProcessLine (this=0x7fa3c082d600, line=0x7fa3b48623c0 ".X  /home/dpiparo/./misleadingDiag.C", error=0x7fff62d2d4b4) at /home/dpiparo/RootDevel/Root6/head/root/core/meta/src/TCling.cxx:1889
      #66 0x00007fa3be2476cf in TCling::ProcessLineSynch (this=0x7fa3c082d600, line=0x7fa3b48623c0 ".X  /home/dpiparo/./misleadingDiag.C", error=0x7fff62d2d4b4) at /home/dpiparo/RootDevel/Root6/head/root/core/meta/src/TCling.cxx:2641
      #67 0x00007fa3c2ec5e1d in TApplication::ExecuteFile (file=0x7fff62d2b433 "misleadingDiag.C", error=0x7fff62d2d4b4, keep=false) at /home/dpiparo/RootDevel/Root6/head/root/core/base/src/TApplication.cxx:1114
      #68 0x00007fa3c2ec5190 in TApplication::ProcessFile (this=0x7fa3c08a83c0, file=0x7fff62d2b433 "misleadingDiag.C", error=0x7fff62d2d4b4, keep=false) at /home/dpiparo/RootDevel/Root6/head/root/core/base/src/TApplication.cxx:990
      #69 0x00007fa3c2ec4e78 in TApplication::ProcessLine (this=0x7fa3c08a83c0, line=0x7fff62d2b430 ".x misleadingDiag.C", sync=false, err=0x7fff62d2d4b4) at /home/dpiparo/RootDevel/Root6/head/root/core/base/src/TApplication.cxx:963
      #70 0x00007fa3c25619e1 in TRint::ProcessLineNr (this=0x7fa3c08a83c0, filestem=0x7fa3c2573dbf "ROOT_cli_", line=0x7fff62d2b430 ".x misleadingDiag.C", error=0x7fff62d2d4b4) at /home/dpiparo/RootDevel/Root6/head/root/core/rint/src/TRint.cxx:740
      #71 0x00007fa3c2561433 in TRint::Run (this=0x7fa3c08a83c0, retrn=false) at /home/dpiparo/RootDevel/Root6/head/root/core/rint/src/TRint.cxx:416
      #72 0x0000000000401357 in main (argc=1, argv=0x7fff62d2d618) at /home/dpiparo/RootDevel/Root6/head/root/main/src/rmain.cxx:29

      Note that this macro can fail also because of thread safety issues at the time of submitting this ticket (TMinuit2).

        Attachments

          Activity

            People

            Assignee:
            axel Axel Naumann
            Reporter:
            dpiparo Danilo Piparo
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: