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

Warning in eos::portable_iarchive Due to User-Defined Cast in Boost Serialization #47250

Open
iarspider opened this issue Feb 3, 2025 · 4 comments

Comments

@iarspider
Copy link
Contributor

When compiling CMSSW (CMSSW_15_0_X_2025-02-01-1100) with GCC 14, a warning is triggered in eos::portable_iarchive due to an explicit cast bypassing a user-defined conversion operator in Boost Serialization.

/cvmfs/cms-ib.cern.ch/sw/x86_64/week0/el8_amd64_gcc14/cms/cmssw/CMSSW_15_0_X_2025-02-01-1100/src/CondFormats/Serialization/interface/eos/portable_iarchive.hpp:412:12: warning: casting 'boost::archive::class_id_type' to 'boost::uint_t<16>::least&' {aka 'short unsigned int&'} does not use 'boost::archive::class_id_type::operator base_type&()' [-Wcast-user-defined]
  412 |       load((typename boost::uint_t<sizeof(T) * CHAR_BIT>::least&)(t));
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This suggests that boost::archive::class_id_type has a user-defined conversion operator that should be used instead of a C-style cast.

Possible fixes

  1. Use an explicit static_cast instead of a C-style cast
    Instead of:

    load((typename boost::uint_t<sizeof(T) * CHAR_BIT>::least&)(t));

    Use:

    load(static_cast<typename boost::uint_t<sizeof(T) * CHAR_BIT>::least&>(t));
  2. Use boost::archive::class_id_type::base_type if applicable

    load(static_cast<boost::archive::class_id_type::base_type&>(t));
@iarspider
Copy link
Contributor Author

assign CondFormats/Serialization

@cmsbuild
Copy link
Contributor

cmsbuild commented Feb 3, 2025

New categories assigned: db

@atpathak,@consuegs,@francescobrivio,@perrotta you have been requested to review this Pull request/Issue and eventually sign? Thanks

@cmsbuild
Copy link
Contributor

cmsbuild commented Feb 3, 2025

cms-bot internal usage

@cmsbuild
Copy link
Contributor

cmsbuild commented Feb 3, 2025

A new Issue was created by @iarspider.

@Dr15Jones, @antoniovilela, @makortel, @mandrenguyen, @rappoccio, @sextonkennedy, @smuzaffar can you please review it and eventually sign/assign? Thanks.

cms-bot commands are listed here

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

No branches or pull requests

2 participants