Skip to content

Commit 8e4cbef

Browse files
committed
Fix Wmaybe-uninitialized in SteppingHelixStateInfo
1 parent 4eeb0e8 commit 8e4cbef

File tree

6 files changed

+21
-19
lines changed

6 files changed

+21
-19
lines changed

DataFormats/GEMDigi/interface/GEMOptoHybrid.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class GEMOptoHybrid {
7373
};
7474
};
7575

76-
GEMOptoHybrid() : ch_(0), ct_(0), existVFATs_(0) {}
76+
GEMOptoHybrid() : ver_(0), ch_(0), ct_(0), existVFATs_(0) {}
7777
~GEMOptoHybrid() { vfatd_.clear(); }
7878

7979
void setVersion(uint8_t i) { ver_ = i; }

L1Trigger/GlobalMuonTrigger/src/L1MuGlobalMuonTrigger.cc

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,11 @@ L1MuGlobalMuonTrigger::L1MuGlobalMuonTrigger(const edm::ParameterSet& ps) {
7171
m_ExtendedCands.reserve(20);
7272

7373
// set configuration parameters
74-
if (not m_config) {
74+
if (!std::atomic_load(&m_config)) { // Atomically load m_config
7575
auto temp = std::make_shared<L1MuGMTConfig>(ps);
76-
std::shared_ptr<L1MuGMTConfig> empty;
77-
std::atomic_compare_exchange_strong(&m_config, &empty, temp);
76+
std::shared_ptr<L1MuGMTConfig> empty = nullptr; // Explicit nullptr for CAS
77+
std::atomic_compare_exchange_strong_explicit(
78+
&m_config, &empty, temp, std::memory_order_acq_rel, std::memory_order_acquire);
7879
}
7980
m_writeLUTsAndRegs = ps.getUntrackedParameter<bool>("WriteLUTsAndRegs", false);
8081

@@ -122,10 +123,11 @@ L1MuGlobalMuonTrigger::L1MuGlobalMuonTrigger(const edm::ParameterSet& ps) {
122123
edm::LogVerbatim("GMT_info") << "creating GMT Sorter";
123124
m_Sorter = new L1MuGMTSorter(*this); // barrel
124125

125-
if (not m_db) {
126+
if (!std::atomic_load(&m_db)) { // Atomically load m_db
126127
auto temp = std::make_shared<L1MuGMTDebugBlock>(m_config->getBxMin(), m_config->getBxMax());
127-
std::shared_ptr<L1MuGMTDebugBlock> empty;
128-
std::atomic_compare_exchange_strong(&m_db, &empty, temp);
128+
std::shared_ptr<L1MuGMTDebugBlock> empty = nullptr; // Explicit nullptr for CAS
129+
std::atomic_compare_exchange_strong_explicit(
130+
&m_db, &empty, temp, std::memory_order_acq_rel, std::memory_order_acquire);
129131
}
130132
usesResource("L1MuGlobalMuonTrigger");
131133
///EventSetup Tokens

L1Trigger/L1TMuonEndCap/interface/bdt/Tree.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ namespace emtf {
2020

2121
Tree(const Tree& tree);
2222
Tree& operator=(const Tree& tree);
23-
Tree(Tree&& tree);
23+
Tree(Tree&& tree) noexcept;
2424

2525
void setRootNode(Node* sRootNode);
2626
Node* getRootNode();

L1Trigger/L1TMuonEndCap/src/bdt/Tree.cc

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -135,15 +135,14 @@ void Tree::findLeafs(Node* local_root, std::list<Node*>& tn) {
135135
findLeafs(local_root->getRightDaughter(), tn);
136136
}
137137

138-
Tree::Tree(Tree&& tree) {
139-
if (rootNode)
140-
delete rootNode; // this line is the only reason not to use default move constructor
141-
rootNode = tree.rootNode;
142-
terminalNodes = std::move(tree.terminalNodes);
143-
numTerminalNodes = tree.numTerminalNodes;
144-
rmsError = tree.rmsError;
145-
boostWeight = tree.boostWeight;
146-
xmlVersion = tree.xmlVersion;
138+
Tree::Tree(Tree&& tree) noexcept
139+
: rootNode(tree.rootNode),
140+
terminalNodes(std::move(tree.terminalNodes)),
141+
numTerminalNodes(tree.numTerminalNodes),
142+
rmsError(tree.rmsError),
143+
boostWeight(tree.boostWeight),
144+
xmlVersion(tree.xmlVersion) {
145+
tree.rootNode = nullptr; // this line is the only reason not to use default move constructor
147146
}
148147

149148
//////////////////////////////////////////////////////////////////////////

TrackPropagation/SteppingHelixPropagator/interface/SteppingHelixStateInfo.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ class SteppingHelixStateInfo {
3636
static const std::string ResultName[MAX_RESULT];
3737

3838
SteppingHelixStateInfo()
39-
: path_(0),
39+
: q(0),
40+
path_(0),
4041
radPath_(0),
4142
dir(0),
4243
magVol(nullptr),

Validation/RecoParticleFlow/bin/PlotCompareUtility.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ PlotCompareUtility::PlotCompareUtility(std::string Reference,
2525
std::string RefBasePath,
2626
std::string RefPrefix) {
2727
// open TFiles
28-
cout << refFile << " " << newFile << endl;
28+
cout << Reference << " " << New << endl;
2929
refFile = new TFile(Reference.c_str(), "READ");
3030
newFile = new TFile(New.c_str(), "READ");
3131

0 commit comments

Comments
 (0)