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

variables declared in gROOT->Macro lost from scope

    XMLWordPrintable

    Details

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

      Fedora 25, Centos 7 CERN

      Description

      If a script parses a macro using gROOT->Macro, that defines some variables, these are accessible in that scope, but go out of scope in the context of a loop etc.

      The attached test.C uses gROOT->Macro to read setcolours.C, which defines two const char strings "setgreen" and "setblack". However, they generate the error:

      error: use of undeclared identifier 'setgreen'

      etc. with root-6.08/0X. This is a regression from root-6.06/06, which worked correctly. Note that removing the curly brackets around the cout line brings setgreen and setblack back into scope, but this is not a solution, because it also fails in loops.

      git bisect indicates that the first bad commit could be any of:
      8b441aa6866d9f8005834462db385461e5fc46cb - could not be tested as it segfaults
      f4bb8668fe0ea11846c4bf96f8df6039a3d4a3b6 - could not be tested as it segfaults
      9172c0b8afdd62c0f793c2b9d869be59770018ee

      My guess is that it is the first one (DynLookup: annotate the wrapper instead of visiting it.). That version fails the test with a segfault. I think the second commit has nothing to do with it and the third one just fixes the segfault, but not the regression.

        Attachments

        1. setcolours.C
          0.1 kB
        2. test.C
          0.1 kB

          Activity

            People

            • Assignee:
              axel Axel Naumann
              Reporter:
              nwarr Nigel Victor Warr
            • Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: