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

cling/clang crash on initialization of static template member

    XMLWordPrintable

    Details

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

      lxplus

      Description

      hi -

      In root 6.08.00, the following code crashes cling when i try to retrieve
      the class Foo from python. A complete buildable example is in
      the attached tar file; source `setup' and then run the script `test'.

      The crash does not occur in root 6.06.06.

      I can work around this by hiding the initialization bits in the original
      code from cling, so this is not critical.

      template <typename T> 
      class Hitvec 
      {
      public:
        static int initHelper()  { return 0;  };
        static const int s_info;
      };
       
      template <class T>
      const int Hitvec<T>::s_info = Hitvec<T>::initHelper();
       
      class Foo : public Hitvec<int> {};

      With cling/clang built with debugging, i get an assertion failure:

      python: /afs/cern.ch/work/s/ssnyder/root-6.08.00/root/interpreter/llvm/inst/include/llvm/Support/Casting.h:95: static bool llvm::isa_impl_cl<To, const From*>::doit(const From*) [with To = clang::Expr; From = clang::Stmt]: Assertion `Val && "isa<> used on a null pointer"' failed.

      with backtrace

      #4  0x00007fdd20159766 in llvm::isa_impl_cl<clang::Expr, clang::Stmt const*>::doit (Val=0x0)
          at /afs/cern.ch/work/s/ssnyder/root-6.08.00/root/interpreter/llvm/inst/include/llvm/Support/Casting.h:95
      #5  0x00007fdd2014b26a in llvm::isa_impl_wrap<clang::Expr, clang::Stmt const*, clang::Stmt const*>::doit (Val=@0x7fff10bbd308: 0x0)
          at /afs/cern.ch/work/s/ssnyder/root-6.08.00/root/interpreter/llvm/inst/include/llvm/Support/Casting.h:122
      #6  0x00007fdd2013c3f5 in llvm::isa_impl_wrap<clang::Expr, clang::Stmt* const, clang::Stmt const*>::doit (Val=@0x7fff10bbd348: 0x0)
          at /afs/cern.ch/work/s/ssnyder/root-6.08.00/root/interpreter/llvm/inst/include/llvm/Support/Casting.h:114
      #7  0x00007fdd20130a25 in llvm::isa<clang::Expr, clang::Stmt*> (
          Val=@0x7fff10bbd348: 0x0)
          at /afs/cern.ch/work/s/ssnyder/root-6.08.00/root/interpreter/llvm/inst/include/llvm/Support/Casting.h:134
      #8  0x00007fdd2012701f in llvm::cast<clang::Expr, clang::Stmt> (Val=0x0)
          at /afs/cern.ch/work/s/ssnyder/root-6.08.00/root/interpreter/llvm/inst/include/llvm/Support/Casting.h:237
      #9  0x00007fdd215f150a in clang::VarDecl::evaluateValue (this=0x39e6b298, 
          Notes=...)
          at /afs/cern.ch/user/s/ssnyder/work/root-6.08.00/root/interpreter/llvm/src/tools/clang/lib/AST/Decl.cpp:2158
      #10 0x00007fdd215f1467 in clang::VarDecl::evaluateValue (this=0x39e6b298)
          at /afs/cern.ch/user/s/ssnyder/work/root-6.08.00/root/interpreter/llvm/src/tools/clang/lib/AST/Decl.cpp:2138
      #11 0x00007fdd20192b30 in TClingDataMemberInfo::Offset (this=0x39becb40)
          at /afs/cern.ch/work/s/ssnyder/root-6.08.00/root/core/meta/src/TClingDataMemberInfo.cxx:326
      #12 0x00007fdd200a418e in TCling::DataMemberInfo_Offset (this=0x10b3040, 
          dminfo=0x39becb40)
          at /afs/cern.ch/work/s/ssnyder/root-6.08.00/root/core/meta/src/TCling.cxx:7395
      #13 0x00007fdd27c1fb0d in TDataMember::GetOffsetCint (this=0x39a7ae20)
          at /afs/cern.ch/work/s/ssnyder/root-6.08.00/root/core/meta/src/TDataMember.cxx:680
      ...

        Attachments

          Activity

            People

            Assignee:
            axel Axel Naumann
            Reporter:
            ssnyder Scott Snyder
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: