ROOT v6.10.00 crashes on MacOS High Sierra with the easiest taks!


since I installed ROOT v6.10.00 in my mac running under macOS High Sierra, I cannot use my old macros any more and I do not understand why. Even the easiest commands don’t always work, like for instance if I just try to create a histogram from a ntuple in a Tree by:

 root [0]
Attaching file data_Xiplussel_V2.root as _file0...
(TFile *) 0x7fb7705ccde0
root [1] event->Draw("sqrt(pi1px**2+pi1py**2+pi1pz**2)>>pi1mom(50,0,0.7)");
Info in <TCanvas::MakeDefCanvas>:  created default TCanvas with name c1
root [2] TH1F *pi1mom = new TH1F(*pi1mom);

this results in:

[/Applications/root_v6.10.00/lib/] cling_runtime_internal_throwIfInvalidPointer >(no debug info)
[] (no debug info)
[/Applications/root_v6.10.00/lib/] >cling::IncrementalExecutor::runStaticInitializersOnce(cling::Transaction const&) (no >debug info)
[/Applications/root_v6.10.00/lib/] >cling::Interpreter::executeTransaction(cling::Transaction&) (no debug info)
[/Applications/root_v6.10.00/lib/] >cling::IncrementalParser::commitTransaction(llvm::PointerIntPair<cling::Transaction*, 2u, >cling::IncrementalParser::EParseResult, >llvm::PointerLikeTypeTraitscling::Transaction*, >llvm::PointerIntPairInfo<cling::Transaction*, 2u, >llvm::PointerLikeTypeTraitscling::Transaction* > >&, bool) (no debug info)
[/Applications/root_v6.10.00/lib/] >cling::IncrementalParser::Compile(llvm::StringRef, cling::CompilationOptions const&) (no >debug info)
[/Applications/root_v6.10.00/lib/] >cling::Interpreter::EvaluateInternal(std::__1::basic_string<char, >std::__1::char_traits, std::__1::allocator > const&, >cling::CompilationOptions, cling::Value*, cling::Transaction**, unsigned long) (no debug >info)
[/Applications/root_v6.10.00/lib/] >cling::Interpreter::process(std::__1::basic_string<char, std::__1::char_traits, >std::__1::allocator > const&, cling::Value*, cling::Transaction**, bool) (no debug >info)
[/Applications/root_v6.10.00/lib/] cling::MetaProcessor::process(char const*, >cling::Interpreter::CompilationResult&, cling::Value*, bool) (no debug info)
[/Applications/root_v6.10.00/lib/] >HandleInterpreterException(cling::MetaProcessor*, char const*, >cling::Interpreter::CompilationResult&, cling::Value*) (no debug info)
[/Applications/root_v6.10.00/lib/] TCling::ProcessLine(char const*, >TInterpreter::EErrorCode*) (no debug info)
[/Applications/root_v6.10.00/lib/] TRint::ProcessLineNr(char const*, char const*, >int*) (no debug info)
[/Applications/root_v6.10.00/lib/] TRint::HandleTermInput() (no debug info)
[/Applications/root_v6.10.00/lib/] TUnixSystem::CheckDescriptors() (no debug >info)
[/Applications/root_v6.10.00/lib/] TMacOSXSystem::DispatchOneEvent(bool) >(no debug info)
[/Applications/root_v6.10.00/lib/] TSystem::InnerLoop() (no debug info)
[/Applications/root_v6.10.00/lib/] TSystem::Run() (no debug info)
[/Applications/root_v6.10.00/lib/] TApplication::Run(bool) (no debug info)
[/Applications/root_v6.10.00/lib/] TRint::Run(bool) (no debug info)
[/Applications/root_v6.10.00/bin/root.exe] main (no debug info)
[/usr/lib/system/libdyld.dylib] start (no debug info)
libc++abi.dylib: terminating with uncaught exception of type cling::InvalidDerefException: >Trying to dereference null pointer or trying to call routine taking non-null arguments

Can anyone tell my why?


Dear all,
I know that the previous example works if I just exchange

TH1F *pi1mom = new TH1F(*pi1mom);
TH1F *pi1mom2 = new TH1F(*pi1mom);

but it is a lot of work now changing all working macros. So, is there another way to fix the problem?



How can this have worked ? … and what does it mean ? you create an histogram from “itself”…? what is the purpose of a such line ? Why don’t you do:

TH1F *pi1mom = new TH1F("pi1mom","pi1mom", 50,0,0.7);

How can this have worked ? …

It’s called syntax I guess and that’s about scopes and idenitifiers visibility in C/C++. You can, for example, do this:

int i = i;

results are not so horrible as in OP’s question (there he dereferences an invalid pointer).

@moralcr bad news, if writing correct code is too much work for you, what would you say about reading C++ books?

@couet : I think I started to do this to have copies of a histogram before making operations on it.
When one makes it with a script it can happen that when looping you get i=i, like:

TH1F *pi1mom = new TH1F(*pi1mom);
and this was never a problem in previous ROOT versions.

@tpochep : what about you reading

Yes before version 6 it might be “fine” (even if the result would have been unpredictable) but now ROOT 6 is strictly C++ … With previous version (5.34) you should have get an error if you would have compiled such code using AClic.

No, it will not - it’s a valid declaration (even if it’s undefined behavior as a result).

indeed it is a warning, not an error:

In file included from /Users/couet/roottest/ccc_C_ACLiC_dict.cxx:40:
/Users/couet/roottest/./ccc.C:5:29: warning: variable 'pi1mom' is uninitialized
      when used within its own initialization [-Wuninitialized]
   TH1F *pi1mom = new TH1F(*pi1mom);
         ~~~~~~             ^~~~~~
1 warning generated.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.