Hello again,
This one is a bit creepy, to be honest. I’ve got a piece of code, compiled as a ROOT library and run by a ROOT macro (I’m attaching all the files as an archive). In a nutshell, the macro repeats a certain operation in a loop. Everything compiles fine and when I run the macro in compiled mode
I get what I expect to get (output lines are truncated for brevity):
$ root -q -b run.C+
...
START:
x,y,z = 0.000000 0.000000 -580.000000
STOP:
x,y,z = 0.102393 0.049997 -570.000671
x,y,z = 0.210822 0.099997 -560.000732
x,y,z = 0.327561 0.150002 -550.000000
x,y,z = 0.455498 0.200005 -540.000000
x,y,z = 0.598182 0.250010 -530.000000
...
However, when I run exactly the same code in interpreted mode I get:
$ root -q -b run.C
...
START:
x,y,z = 0.000000 0.000000 -580.000000
STOP:
x,y,z = 0.102393 0.049997 -570.000671
x,y,z = 0.210822 0.099997 -560.000732
x,y,z = 0.210822 0.099997 -560.000732
x,y,z = 0.210822 0.099997 -560.000732
x,y,z = 0.210822 0.099997 -560.000732
...
If I print the value of z before calling T49Trkstep::TrackTo() it is correct, indeed even without printing the loop finishes after the right number of iterations - but TrackTo() appears to be doing nothing. The creepy part is that I display the value of either z or fXstop[2] inside TrackTo(), before calling trkstep_nods(), the code works fine!
I have tried this with 32-bit Linux ROOT version: 5.14.00g, 5.16.00 and 5.18.00a, with identical results.
stuckInInterpreted.tar.gz (11.4 KB)