You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
is process line by line (per se) and statement_2 should (and does in most case) be able to use declaration made in statement_1. In some circumstances it does not. One such circumstance is the test roottest-cling-return-constRetrunTest_WILL_FAIL which should actually succeed (the original problem is fixed by moving to Cling) but still fails (unexpectedly) with:
Processing run.C...
/Users/pcanal/root_working/code/master/roottest/cling/return/./run.C:7:1: error: unknown type name 't02'
t02 t;
^
Reproducer
With the files in trun.tar.gz
we can set that the declaration in the ProcessLine are properly seen in the next lines. For example this version of trun.C:
{
gROOT->ProcessLine(".L t1.C");
gROOT->ProcessLine(".L t2.C");
int i123 = t_1;
int j123 = t_2;
}
works fine. Note that issuing on the prompt right after the .x trun.C the command gROOT->SetDirLevel(t_1); or i123 = t_2; works as well.
But this version:
{
gROOT->ProcessLine(".L t1.C");
gROOT->ProcessLine(".L t2.C");
int i123 = t_1;
int j123 = t_2;
gROOT->SetDirLevel(t_1);
}
mysteriously fails with:
Processing trun.C...
/Users/pcanal/root_working/code/master/roottest/cling/return/./trun.C:7:1: error: cannot initialize an array element of type 'void *' with an rvalue of type 'TROOT *(*)()'
gROOT->SetDirLevel(t_1);
^~~~~
/Users/pcanal/root_working/builds/master-pr/include/TROOT.h:407:16: note: expanded from macro 'gROOT'
#define gROOT (ROOT::GetROOT())
^~~~~~~~~~~~~
The error seems to indicate that the parser is 'prefixing' to gROOT something related to array of void* and initialization
Similarly
{
gROOT->ProcessLine(".L t1.C");
gROOT->ProcessLine(".L t2.C");
int i123 = t_1;
int j123 = t_2;
i123 = t_2;
}
fails with:
Processing trun.C...
Assertion failed: (Node->getDependence() == ExprDependence::None), function VisitBinaryOperator, file DynamicLookup.cpp, line 628.
Abort trap: 6
And weirdly:
{
gROOT->ProcessLine(".L t1.C");
gROOT->ProcessLine(".L t2.C");
int i123 = t_1;
int j123 = t_2;
t_1 = 3;
}
fails with:
/Users/pcanal/root_working/code/master/roottest/cling/return/./trun.C:7:1: warning: declaration without the 'auto' keyword is deprecated: function '__cling_Un1Qu30' [-Wdeprecated-declarations]
t_1 = 3;
^~~
auto
input_line_11:2:3: error: reference to 't_1' is ambiguous
(t_1)
^
/Users/pcanal/root_working/code/master/roottest/cling/return/t1.C:1:5: note: candidate found by name lookup is 't_1'
int t_1 = 3;
^
/Users/pcanal/root_working/code/master/roottest/cling/return/./trun.C:7:1: note: candidate found by name lookup is '__cling_N50::t_1'
t_1 = 3;
^
input_line_11:2:3: error: unknown type name 't_1'
(t_1)
^
The text was updated successfully, but these errors were encountered:
pcanal
changed the title
Calling ProcessLine in an unnamed macro leave Cling in a broken state.
Calling ProcessLine in an unnamed macro leave Cling in a broken state .. sometimes
May 10, 2024
I personally don't think this should block the 6.32 release: As far as I understand, this has basically always been broken in Cling, and I verified that constRetrunTest_WILL_FAIL doesn't pass either on 6.20 using LLVM 5:
1079: Processing /home/jhahnfel/ROOT/v6-20-00-patches/src/roottest/cling/return/run.C...
1079: /home/jhahnfel/ROOT/v6-20-00-patches/src/roottest/cling/return/run.C:7:4: error: expected ';' after expression
1079: t02 t;
1079: ^
1079: ;
1079: /home/jhahnfel/ROOT/v6-20-00-patches/src/roottest/cling/return/run.C:7:5: error: use of undeclared identifier 't'
1079: t02 t;
1079: ^
1079: /home/jhahnfel/ROOT/v6-20-00-patches/src/roottest/cling/return/run.C:8:15: error: use of undeclared identifier 't'
1079: TObject o = **t.getVal();
1079: ^
1079: /home/jhahnfel/ROOT/v6-20-00-patches/src/roottest/cling/return/run.C:9:24: error: use of undeclared identifier 't'
1079: TObject * const * op = t.getVal();
1079: ^
Will_Fail is the (now) expected result and lead to a 'succesfull' run of the test. What is "new" is that there is one platform where this failure is now a segmentation fault of sort.
Description
In an unnamed macro having:
is process line by line (per se) and
statement_2
should (and does in most case) be able to use declaration made instatement_1
. In some circumstances it does not. One such circumstance is the testroottest-cling-return-constRetrunTest_WILL_FAIL
which should actually succeed (the original problem is fixed by moving toCling
) but still fails (unexpectedly) with:Reproducer
With the files in trun.tar.gz
we can set that the declaration in the
ProcessLine
are properly seen in the next lines. For example this version oftrun.C
:works fine. Note that issuing on the prompt right after the
.x trun.C
the commandgROOT->SetDirLevel(t_1);
ori123 = t_2;
works as well.But this version:
mysteriously fails with:
The error seems to indicate that the parser is 'prefixing' to
gROOT
something related toarray of void*
and initializationSimilarly
fails with:
And weirdly:
fails with:
The text was updated successfully, but these errors were encountered: