Skip to content

FTHitExpectation: Fix uninitialised variable warning

Christopher Rob Jones requested to merge jonrob/Rec:FixFTWarning into master

Addresses

../Tr/TrackTools/src/FTHitExpectation.cpp: In static member function ‘static _Res std::_Function_handler<_Res(_ArgTypes ...), _Functor>::_M_invoke(const std::_Any_data&, _ArgTypes&& ...) [with _Res = void; _Functor = FTHitExpectation::collect(const Track&, std::vector<LHCb::LHCbID>&, const IGeometryInfo&) const::<lambda(const DeFTLayer&)>; _ArgTypes = {LHCb::Detector::DeIOVElement<LHCb::Detector::detail::DeIOVObject>}]’:
../Tr/TrackTools/src/FTHitExpectation.cpp:175:62: warning: ‘frac’ may be used uninitialized [-Wmaybe-uninitialized]
  175 |       LHCb::FTChannelID ftChan = mat->calculateChannelAndFrac( localP.x(), frac );
      |                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
../Tr/TrackTools/src/FTHitExpectation.cpp:174:25: note: ‘frac’ was declared here
  174 |       float             frac;
      |                         ^~~~

Seen in a x86_64_v2-centos7-gcc11+dd4hep-dbg build.

Merge request reports