From 42fc50dedf56954ae1f58cc74091ade8daa8a873 Mon Sep 17 00:00:00 2001 From: David Abdurachmanov Date: Sun, 17 Jan 2016 16:00:02 -0500 Subject: [PATCH] Default-initialize SubTurbineCrossings fields 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&) 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 (cherry picked from commit e6c60626b97d9d75acb6a0c0b7b24ae710b59028) --- RecoTracker/TkDetLayers/src/PixelForwardLayer.h | 2 +- RecoTracker/TkDetLayers/src/PixelForwardLayerPhase1.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/RecoTracker/TkDetLayers/src/PixelForwardLayer.h b/RecoTracker/TkDetLayers/src/PixelForwardLayer.h index 0289b695cf074..bb9148b8c0115 100644 --- a/RecoTracker/TkDetLayers/src/PixelForwardLayer.h +++ b/RecoTracker/TkDetLayers/src/PixelForwardLayer.h @@ -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) {} diff --git a/RecoTracker/TkDetLayers/src/PixelForwardLayerPhase1.h b/RecoTracker/TkDetLayers/src/PixelForwardLayerPhase1.h index 6e927f3eb7d8e..24aba8fc19da8 100644 --- a/RecoTracker/TkDetLayers/src/PixelForwardLayerPhase1.h +++ b/RecoTracker/TkDetLayers/src/PixelForwardLayerPhase1.h @@ -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) {}