Skip to content

Commit

Permalink
Default-initialize SubTurbineCrossings fields
Browse files Browse the repository at this point in the history
Add default values for closestIndex (0), nextIndex (0), nextDistance (0.0f).

Should resolve the following compiler errors:

    src/RecoTracker/TkDetLayers/src/PixelForwardLayerPhase1.cc: In member function 'virtual void PixelForwardLayerPhase1::groupedCompatibleDetsV(const TrajectoryStateOnSurface&, const Propagator&, const MeasurementEstim
    ator&, std::vector<DetGroup>&) const':
    src/RecoTracker/TkDetLayers/src/PixelForwardLayerPhase1.cc:232:70: error: 'crossings_inner.PixelForwardLayerPhase1::SubTurbineCrossings::nextIndex' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      int negStart = min( crossings.closestIndex, crossings.nextIndex) - 1;
                                                                         ^
    src/RecoTracker/TkDetLayers/src/PixelForwardLayerPhase1.cc:124:24: note: 'crossings_inner.PixelForwardLayerPhase1::SubTurbineCrossings::nextIndex' was declared here
      SubTurbineCrossings  crossings_inner;
                           ^
    src/RecoTracker/TkDetLayers/src/PixelForwardLayerPhase1.cc:232:70: error: 'crossings_inner.PixelForwardLayerPhase1::SubTurbineCrossings::closestIndex' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      int negStart = min( crossings.closestIndex, crossings.nextIndex) - 1;
                                                                         ^
    src/RecoTracker/TkDetLayers/src/PixelForwardLayerPhase1.cc:124:24: note: 'crossings_inner.PixelForwardLayerPhase1::SubTurbineCrossings::closestIndex' was declared here
      SubTurbineCrossings  crossings_inner;
                           ^

Signed-off-by: David Abdurachmanov <[email protected]>
(cherry picked from commit e6c6062)
  • Loading branch information
David Abdurachmanov authored and cmsbuild committed Jan 19, 2016
1 parent 76ce5e6 commit 42fc50d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion RecoTracker/TkDetLayers/src/PixelForwardLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class PixelForwardLayer final : public ForwardDetLayer {
static int computeHelicity(const GeometricSearchDet* firstBlade,const GeometricSearchDet* secondBlade);

struct SubTurbineCrossings {
SubTurbineCrossings(): isValid(false){}
SubTurbineCrossings(): isValid(false), closestIndex(0), nextIndex(0), nextDistance(0.0f) {}
SubTurbineCrossings( int ci, int ni, float nd) :
isValid(true),closestIndex(ci), nextIndex(ni), nextDistance(nd) {}

Expand Down
2 changes: 1 addition & 1 deletion RecoTracker/TkDetLayers/src/PixelForwardLayerPhase1.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class PixelForwardLayerPhase1 final : public ForwardDetLayer {
static int computeHelicity(const GeometricSearchDet* firstBlade,const GeometricSearchDet* secondBlade);

struct SubTurbineCrossings {
SubTurbineCrossings(): isValid(false){}
SubTurbineCrossings(): isValid(false), closestIndex(0), nextIndex(0), nextDistance(0.0f) {}
SubTurbineCrossings( int ci, int ni, float nd) :
isValid(true),closestIndex(ci), nextIndex(ni), nextDistance(nd) {}

Expand Down

0 comments on commit 42fc50d

Please sign in to comment.