Multiple Steps on geometricBoundary

Hi everyone,
I have an observation that does not make to much sense to me… the code is as follows:

void VolumeRecorder::UserSteppingAction(const G4Step* aStep)
{
    G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
    // process inbound particles only
    if (preStepPoint->GetStepStatus() != fGeomBoundary) {
        return;
    }

    G4cerr << "Debug: StepStatus:  "
           << preStepPoint->GetStepStatus()
           << " IsFirstStepInVolume: " << aStep->IsFirstStepInVolume() 
           << G4endl;
    ...

I would expect only one step within the volume and on the boundary, and indeed, the windows machine gives:

G4WT1 > Debug: StepStatus: 1 IsFirstStepInVolume: 1
G4WT1 > Debug: StepStatus: 1 IsFirstStepInVolume: 1
G4WT1 > Debug: StepStatus: 1 IsFirstStepInVolume: 1
G4WT1 > Debug: StepStatus: 1 IsFirstStepInVolume: 1
G4WT1 > Debug: StepStatus: 1 IsFirstStepInVolume: 1

for a trajectory across multiple volumes with that UserSteppingAction.

However, on the ubuntu 20.04.1 machine, the very same code yields a pattern like this:

G4WT0 > Debug: StepStatus: 1 IsFirstStepInVolume: 1
G4WT0 > Debug: StepStatus: 1 IsFirstStepInVolume: 0
G4WT0 > Debug: StepStatus: 1 IsFirstStepInVolume: 0
G4WT0 > Debug: StepStatus: 1 IsFirstStepInVolume: 0
G4WT0 > Debug: StepStatus: 1 IsFirstStepInVolume: 1
G4WT0 > Debug: StepStatus: 1 IsFirstStepInVolume: 0
G4WT0 > Debug: StepStatus: 1 IsFirstStepInVolume: 0

In order to only catch inbound particles, apparently I would have to filter for both fGeomBoundary and IsFirstStepInVolume, but only on the linux machine. Is that expected behavior for certain configurations?

cmake options for geant4.11.1.1 build:
windows:

    -DGEANT4_BUILD_MULTITHREADED=ON `
    -DGEANT4_BUILD_MSVC_MP=ON `
    -DCMAKE_BUILD_TYPE=RelWithDebInfo

linux:

    -DGEANT4_BUILD_MULTITHREADED=ON \
    -DGEANT4_BUILD_VERBOSE_CODE=OFF \
    -DGEANT4_BUILD_STORE_TRAJECTORY=OFF \
    -DGEANT4_BUILD_BUILTIN_BACKTRACE=OFF \
    -DCMAKE_BUILD_TYPE=Release 

Any ideas? Should I file a bug report?
Thanks in advance :slight_smile: