cmssw icon indicating copy to clipboard operation
cmssw copied to clipboard

[DQM]L1TOccupancyClient: Bug fix and fixes static analyzer warning

Open smuzaffar opened this issue 4 months ago • 5 comments

This PR proposes following changes

  • code clean: Call getAvrg only when needed
  • Bug fix: Fill maxAvgs using the correct correct index nActualStrips
  • Call TMath::MinElement only if nActualStrips>0 otherwise we have a uninitialize maxAvgs. This fixes clang analyzer warning [a]

[a] https://cmssdt.cern.ch/SDT/jenkins-artifacts/ib-static-analysis/CMSSW_14_2_X_2024-10-16-1100/el8_amd64_gcc12/llvm-analysis/report-4ed65d.html#EndPath

In file included from src/DQM/L1TMonitorClient/src/L1TOccupancyClient.cc:1:
In file included from src/DQM/L1TMonitorClient/interface/L1TOccupancyClient.h:9:
In file included from src/DQMServices/Core/interface/DQMStore.h:4:
In file included from src/DQMServices/Core/interface/MonitorElement.h:15:
In file included from root/6.30.09-c59d6b036f1cbd6988c172ba319259f1/include/TF1.h:36:
  root/6.30.09-c59d6b036f1cbd6988c172ba319259f1/include/TMath.h:961:4: warning: Undefined or garbage value returned to caller [core.uninitialized.UndefReturn]
   961 |    return *std::min_element(a,a+n);

smuzaffar avatar Oct 18 '24 13:10 smuzaffar