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

cling assertion crash #8389

Closed
ferdymercury opened this issue Jun 9, 2021 · 3 comments · Fixed by #9245
Closed

cling assertion crash #8389

ferdymercury opened this issue Jun 9, 2021 · 3 comments · Fixed by #9245

Comments

@ferdymercury
Copy link
Collaborator

Describe the bug

One time, I made a typo when writing something in the interpreter that made whole ROOT crash.

Expected behavior

A warning is issued instead of crashing.

To Reproduce

root [0] for(auto& p : pn9) cout << std::bitset<14>(p) << endl;
ROOT_prompt_0:1:50: error: cannot initialize an array element of type 'void *' with an rvalue of type 'basic_ostream<char, std::char_traits<char> > &(*)(basic_ostream<char, std::char_traits<char> > &)'
for(auto& p : pn9) cout << std::bitset<14>(p) << endl;
                                                 ^~~~
root.exe: /opt/root_src/interpreter/cling/lib/Interpreter/DynamicLookup.cpp:764: clang::Expr* cling::EvaluateTSynthesizer::BuildDynamicExprInfo(clang::Expr*, bool): Assertion `ExprAddresses && "Could not build the void* array"' failed.

Setup

   ------------------------------------------------------------------
  | Welcome to ROOT 6.25/01                        https://root.cern |
  | (c) 1995-2021, The ROOT Team; conception: R. Brun, F. Rademakers |
  | Built for linuxx8664gcc on Jun 09 2021, 21:20:28                 |
  | From heads/master@v6-25-01-1189-g1ca221f010                      |
  | With                                                             |
  | Try '.help', '.demo', '.license', '.credits', '.quit'/'.q'       |
   ------------------------------------------------------------------

Additional context

Not sure why, maybe cause I built in 'debug mode' or it is another version, but I have another computer where it does not crash.

 root -b
   ------------------------------------------------------------------
  | Welcome to ROOT 6.25/01                        https://root.cern |
  | (c) 1995-2021, The ROOT Team; conception: R. Brun, F. Rademakers |
  | Built for linuxx8664gcc on Jun 08 2021, 21:53:04                 |
  | From heads/master@v6-25-01-1189-g1ca221f010                      |
  | With                                                             |
  | Try '.help', '.demo', '.license', '.credits', '.quit'/'.q'       |
   ------------------------------------------------------------------

root [0] for(auto& p : pn9) cout << std::bitset<14>(p) << endl;
ROOT_prompt_0:1:50: error: cannot initialize an array element of type 'void *' with an rvalue of type 'basic_ostream<char, std::char_traits<char> > &(*)(basic_ostream<char, std::char_traits<char> > &)'
for(auto& p : pn9) cout << std::bitset<14>(p) << endl;
                                                 ^~~~
ROOT_prompt_0:1:20: error: no viable conversion from 'std::basic_ostream<char, std::char_traits<char> >::__ostream_type' (aka 'basic_ostream<char, std::char_traits<char> >') to 'cling::runtime::internal::DynamicExprInfo *'
for(auto& p : pn9) cout << std::bitset<14>(p) << endl;
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/huesof/builds/build-root_src-Desktop-Debug/etc/cling/Interpreter/RuntimeUniverse.h:53:7: note: in instantiation of member function 'cling::runtime::internal::EvaluateT' requested here
      int InterpreterGeneratedCodeDiagnosticsMaybeIncorrect;
      ^
/home/huesof/builds/build-root_src-Desktop-Debug/etc/cling/Interpreter/DynamicLookupRuntimeUniverse.h:65:44: note: passing argument to parameter 'ExprInfo' here
    inline void EvaluateT(DynamicExprInfo* ExprInfo, clang::DeclContext* DC ) {
                                           ^
root [1] .q
@jalopezg-git
Copy link
Collaborator

jalopezg-git commented Oct 21, 2021

@ferdymercury, it seems that in the first case it was a debug build while the second was a release build.

However, looking at https://github.com/root-project/cling/blob/master/lib/Interpreter/DynamicLookup.cpp#L764-L766, I'm not sure that the assertion is useful, given that it seems to be safe to exit the function if the CompoundLiteralExpr node was not built.

@vgvassilev, any preferences? Should I remove the assert()?

@jalopezg-git
Copy link
Collaborator

jalopezg-git commented Nov 2, 2021

@axel, @vgvassilev, any preferences on this?

@vgvassilev
Copy link
Member

Hm... yeah, maybe removing the assert is the way to go.

jalopezg-git added a commit to jalopezg-git/root that referenced this issue Nov 4, 2021
The case of `ExprAddresses == nullptr` seems to be naturally handled in the
lines below. Therefore, removing this assertion -as discussed with vvassilev.

Closes issue root-project#8389.
jalopezg-git added a commit that referenced this issue Nov 4, 2021
The case of `ExprAddresses == nullptr` seems to be naturally handled in the
lines below. Therefore, removing this assertion -as discussed with vvassilev.

Closes issue #8389.
@jalopezg-git jalopezg-git added this to Issues in Fixed in 6.26/00 via automation Nov 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

3 participants