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

Wrong cast of functions in TGlobalMappedFunction

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: master
    • Fix Version/s: 6.16/00, 6.14/06
    • Component/s: Core Libraries
    • Labels:
      None
    • Environment:

      gcc 8.2, Linux 64bit

    • Development:

      Description

      Compiler shows warning about wrong function cast.

      Function pointer with signature

      void* &(*)()

      casted into function pointer with signature

      void* (*)()

      I propose just support both signature independent in TGlobalMappedFunction - with very small overhead.

      I can provide PR for it.

      Compiler output:

          /home/linev/git/webgui/core/base/src/TROOT.cxx: In member function ‘TCollection* TROOT::GetListOfGlobals(Bool_t)’:
          /home/linev/git/webgui/core/base/src/TROOT.cxx:1769:96: warning: cast between incompatible function types from ‘TVirtualPad*& (*)()’ to ‘TGlobalMappedFunction::GlobalFunc_t’ {aka ‘void* (*)()’} [-Wcast-function-type]
                                                   (TGlobalMappedFunction::GlobalFunc_t)&TVirtualPad::Pad));
                                                                                                      ^~~
      /home/linev/git/webgui/core/base/src/TROOT.cxx:1773:94: warning: cast between incompatible function types from ‘TVirtualX*& (*)()’ to ‘TGlobalMappedFunction::GlobalFunc_t’ {aka ‘void* (*)()’} [-Wcast-function-type]
                                                   (TGlobalMappedFunction::GlobalFunc_t)&TVirtualX::Instance));
                                                                                                    ^~~~~~~~
      /home/linev/git/webgui/core/base/src/TROOT.cxx:1775:95: warning: cast between incompatible function types from ‘TDirectory*& (*)()’ to ‘TGlobalMappedFunction::GlobalFunc_t’ {aka ‘void* (*)()’} [-Wcast-function-type]
                                                   (TGlobalMappedFunction::GlobalFunc_t)&TDirectory::CurrentDirectory));
                                                                                                     ^~~~~~~~~~~~~~~~
      

        Attachments

          Activity

            People

            Assignee:
            axel Axel Naumann
            Reporter:
            slinev Serguei Linev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Actual End: