Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use max instead if infinity which hasundefined behavior #45488

Merged
merged 1 commit into from
Jul 18, 2024

Conversation

smuzaffar
Copy link
Contributor

Fixes #45181

As proposed in #45181 (comment) , this PR replaces std::numeric_limits<float>::infinity() with std::numeric_limits<float>::max() . This should fix the compilation warnings in CLANG IBs.

[a]

  src/DataFormats/EgammaReco/interface/ElectronSeed.h:115:46: warning: use of infinity is undefined behavior due to the currently enabled floating-point options [-Wnan-infinity-disabled]
   115 |     void setNegAttributes(const float dRZ2 = std::numeric_limits<float>::infinity(),
      |                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  src/DataFormats/EgammaReco/interface/ElectronSeed.h:116:47: warning: use of infinity is undefined behavior due to the currently enabled floating-point options [-Wnan-infinity-disabled]
   116 |                           const float dPhi2 = std::numeric_limits<float>::infinity(),
      |                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  src/DataFormats/EgammaReco/interface/ElectronSeed.h:117:46: warning: use of infinity is undefined behavior due to the currently enabled floating-point options [-Wnan-infinity-disabled]
   117 |                           const float dRZ1 = std::numeric_limits<float>::infinity(),
      |                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  src/DataFormats/EgammaReco/interface/ElectronSeed.h:118:47: warning: use of infinity is undefined behavior due to the currently enabled floating-point options [-Wnan-infinity-disabled]
   118 |                           const float dPhi1 = std::numeric_limits<float>::infinity());
      |                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  src/DataFormats/EgammaReco/interface/ElectronSeed.h:119:46: warning: use of infinity is undefined behavior due to the currently enabled floating-point options [-Wnan-infinity-disabled]
   119 |     void setPosAttributes(const float dRZ2 = std::numeric_limits<float>::infinity(),
      |                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  src/DataFormats/EgammaReco/interface/ElectronSeed.h:120:47: warning: use of infinity is undefined behavior due to the currently enabled floating-point options [-Wnan-infinity-disabled]
   120 |                           const float dPhi2 = std::numeric_limits<float>::infinity(),
      |                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  src/DataFormats/EgammaReco/interface/ElectronSeed.h:121:46: warning: use of infinity is undefined behavior due to the currently enabled floating-point options [-Wnan-infinity-disabled]
   121 |                           const float dRZ1 = std::numeric_limits<float>::infinity(),
      |                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  src/DataFormats/EgammaReco/interface/ElectronSeed.h:122:47: warning: use of infinity is undefined behavior due to the currently enabled floating-point options [-Wnan-infinity-disabled]
   122 |                           const float dPhi1 = std::numeric_limits<float>::infinity());
      |                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  src/DataFormats/EgammaReco/interface/ElectronSeed.h:143:63: warning: use of infinity is undefined behavior due to the currently enabled floating-point options [-Wnan-infinity-disabled]
   143 |       return hitNr < hitInfo_.size() ? hitInfo_[hitNr].*val : std::numeric_limits<T>::infinity();
      |                                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/DataFormats/EgammaReco/interface/ElectronSeed.h:102:48: note: in instantiation of function template specialization 'reco::ElectronSeed::getVal<float>' requested here
  102 |     float dPhiNeg(size_t hitNr) const { return getVal(hitNr, &PMVars::dPhiNeg); }
      |                                                ^
  src/DataFormats/EgammaReco/interface/ElectronSeed.h:143:63: warning: use of infinity is undefined behavior due to the currently enabled floating-point options [-Wnan-infinity-disabled]
   143 |       return hitNr < hitInfo_.size() ? hitInfo_[hitNr].*val : std::numeric_limits<T>::infinity();

@smuzaffar
Copy link
Contributor Author

please test

@cmsbuild
Copy link
Contributor

cmsbuild commented Jul 18, 2024

cms-bot internal usage

@cmsbuild
Copy link
Contributor

@cmsbuild
Copy link
Contributor

A new Pull Request was created by @smuzaffar for master.

It involves the following packages:

  • DataFormats/EgammaReco (reconstruction)
  • DataFormats/Math (reconstruction)

@jfernan2, @mandrenguyen can you please review it and eventually sign? Thanks.
@Prasant1993, @Sam-Harper, @a-kapoor, @afiqaize, @fabiocos, @felicepantaleo, @jainshilpi, @lgray, @makortel, @missirol, @mmusich, @rovere, @sameasy, @sobhatta, @varuns23 this is something you requested to watch as well.
@antoniovilela, @mandrenguyen, @rappoccio, @sextonkennedy you are the release manager for this.

cms-bot commands are listed here

@smuzaffar
Copy link
Contributor Author

please test for CMSSW_14_1_CLANG_X

@cmsbuild
Copy link
Contributor

@cmsbuild
Copy link
Contributor

Pull request #45488 was updated. @cmsbuild, @jfernan2, @mandrenguyen can you please check and sign again.

@jfernan2
Copy link
Contributor

please test for CMSSW_14_1_CLANG_X
It got stuck somehow

@smuzaffar
Copy link
Contributor Author

please test

Run production arch tests too

@cmsbuild
Copy link
Contributor

+1

Size: This PR adds an extra 28KB to repository
Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-c73922/40466/summary.html
COMMIT: 3d04e1f
CMSSW: CMSSW_14_1_X_2024-07-18-1100/el8_amd64_gcc12
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week0/cms-sw/cmssw/45488/40466/install.sh to create a dev area with all the needed externals and cmssw changes.

  • DAS Queries: The DAS query tests failed, see the summary page for details.

Comparison Summary

Summary:

@cmsbuild
Copy link
Contributor

+1

Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-c73922/40465/summary.html
COMMIT: 3d04e1f
CMSSW: CMSSW_14_1_CLANG_X_2024-07-17-1700/el8_amd64_gcc12
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week0/cms-sw/cmssw/45488/40465/install.sh to create a dev area with all the needed externals and cmssw changes.

Comparison Summary

Summary:

  • You potentially added 13795 lines to the logs
  • Reco comparison results: 36751 differences found in the comparisons
  • DQMHistoTests: Total files compared: 48
  • DQMHistoTests: Total histograms compared: 3345208
  • DQMHistoTests: Total failures: 35252
  • DQMHistoTests: Total nulls: 120
  • DQMHistoTests: Total successes: 3309816
  • DQMHistoTests: Total skipped: 20
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.05 KiB( 47 files compared)
  • DQMHistoSizes: changed ( 140.043 ): -0.008 KiB JetMET/SUSYDQM
  • DQMHistoSizes: changed ( 140.063 ): 0.004 KiB JetMET/SUSYDQM
  • DQMHistoSizes: changed ( 141.042 ): 0.023 KiB JetMET/SUSYDQM
  • DQMHistoSizes: changed ( 141.044 ): 0.043 KiB JetMET/SUSYDQM
  • DQMHistoSizes: changed ( 141.046 ): -0.012 KiB JetMET/SUSYDQM
  • Checked 202 log files, 165 edm output root files, 48 DQM output files
  • TriggerResults: found differences in 7 / 46 workflows

@jfernan2
Copy link
Contributor

fixes #45181

@jfernan2
Copy link
Contributor

+1

@cmsbuild
Copy link
Contributor

This pull request is fully signed and it will be integrated in one of the next master IBs (tests are also fine). This pull request will now be reviewed by the release team before it's merged. @antoniovilela, @mandrenguyen, @sextonkennedy, @rappoccio (and backports should be raised in the release meeting by the corresponding L2)

@rappoccio
Copy link
Contributor

+1

@cmsbuild cmsbuild merged commit a18756f into cms-sw:master Jul 18, 2024
17 checks passed
@mmusich
Copy link
Contributor

mmusich commented Oct 21, 2024

Looks like this

Screenshot from 2024-10-21 16-10-51

was ignored in the review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CLANG_X] use of infinity is undefined behavior due to the currently enabled floating-point options
5 participants