Skip to content
Snippets Groups Projects

Property - Default initialise temporary to avoid GCC7 warnings.

All threads resolved!

When building the LHCb stack using GCC7, and I seeing warnings like

[1493/1506] Building CXX object Rich/RichFutureDAQ/CMakeFiles/RichFutureDAQ.dir/src/RichRawBankDecoder.cpp.o
In file included from /usera/jonesc/LHCbCMake/Master/Gaudi/InstallArea/x86_64-centos7-gcc7-opt/include/GaudiKernel/TypeNameString.h:3:0,
                 from /usera/jonesc/LHCbCMake/Master/Gaudi/InstallArea/x86_64-centos7-gcc7-opt/include/GaudiKernel/ISvcManager.h:7,
                 from /usera/jonesc/LHCbCMake/Master/Gaudi/InstallArea/x86_64-centos7-gcc7-opt/include/GaudiKernel/ISvcLocator.h:6,
                 from /usera/jonesc/LHCbCMake/Master/Gaudi/InstallArea/x86_64-centos7-gcc7-opt/include/GaudiKernel/Algorithm.h:11,
                 from /usera/jonesc/LHCbCMake/Master/Gaudi/InstallArea/x86_64-centos7-gcc7-opt/include/GaudiAlg/GaudiAlgorithm.h:11,
                 from ../Rich/RichFutureKernel/RichFutureKernel/RichAlgBase.h:15,
                 from /var/clus/usera/jonesc/LHCbCMake/Master/LHCb/Rich/RichFutureDAQ/src/RichRawBankDecoder.h:16,
                 from /var/clus/usera/jonesc/LHCbCMake/Master/LHCb/Rich/RichFutureDAQ/src/RichRawBankDecoder.cpp:3:
/usera/jonesc/LHCbCMake/Master/Gaudi/InstallArea/x86_64-centos7-gcc7-opt/include/GaudiKernel/Property.h: In member function ‘StatusCode Gaudi::Property<TYPE, VERIFIER, HANDLERS>::fromString(const string&) [with TYPE = std::array<bool, 2>; VERIFIER = Gaudi::Details::Property::NullVerifier; HANDLERS = Gaudi::Details::Property::UpdateHandler]’:
/usera/jonesc/LHCbCMake/Master/Gaudi/InstallArea/x86_64-centos7-gcc7-opt/include/GaudiKernel/Property.h:468:7: warning: ‘*((void*)& tmp +1)’ may be used uninitialized in this function [-Wmaybe-uninitialized]
       m_value = std::forward<T>( v );
       ^~~~~~~
/usera/jonesc/LHCbCMake/Master/Gaudi/InstallArea/x86_64-centos7-gcc7-opt/include/GaudiKernel/Property.h:162:16: note: ‘*((void*)& tmp +1)’ was declared here
           TYPE tmp;
                ^~~
/usera/jonesc/LHCbCMake/Master/Gaudi/InstallArea/x86_64-centos7-gcc7-opt/include/GaudiKernel/Property.h:468:7: warning: ‘tmp’ may be used uninitialized in this function [-Wmaybe-uninitialized]
       m_value = std::forward<T>( v );
       ^~~~~~~
/usera/jonesc/LHCbCMake/Master/Gaudi/InstallArea/x86_64-centos7-gcc7-opt/include/GaudiKernel/Property.h:162:16: note: ‘tmp’ was declared here
           TYPE tmp;
                ^~~

The issue is the method toString creates a temporary which could (or GCC7 things it could) be used uninitialised. This MR simply adds a default initializer to the temporary.

Edited by Christopher Rob Jones

Merge request reports

Checking pipeline status.

Approved by

Merged by avatar (Apr 23, 2025 3:58pm UTC)

Merge details

  • Changes merged into master with 72f52a3d (commits were squashed).
  • Deleted the source branch.

Pipeline #198341 failed

Pipeline failed for 72f52a3d on master

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Marco Clemencic resolved all discussions

    resolved all discussions

  • Marco Clemencic changed milestone to %v29r0

    changed milestone to %v29r0

  • assigned to @hegner

  • @hegner, please, squash it when you merge: there's a lot of spurious history.

    Alternatively (cleaner), @jonrob, you could rebase your branch.

  • Rebasing is something I haven't fully got to grips with... I think I have rebased the branch to master in my local checkout

    git rebase master

    but when I try and push that to gitlab I get

    CernVM ~/LHCbCMake/Master/Gaudi > git push origin GaudiKernel-Property-DefaultInitTemp
    To ssh://git@gitlab.cern.ch:7999/jonrob/Gaudi.git
     ! [rejected]        GaudiKernel-Property-DefaultInitTemp -> GaudiKernel-Property-DefaultInitTemp (non-fast-forward)
    error: failed to push some refs to 'ssh://git@gitlab.cern.ch:7999/jonrob/Gaudi.git'
    To prevent you from losing history, non-fast-forward updates were rejected
    Merge the remote changes before pushing again.  See the 'Note about
    fast-forwards' section of 'git push --help' for details.

    Presumably I am doing this wrong ?

  • No, this is just git's way of telling you that rebasing is a fairly invasive operation that alters the commit history in a fashion that could confuse anyone who would have based work on your remote branch.

    Since there is no risk of this happening on this MR originating from your private fork, you can press the "I know what I'm doing" big red button by adding the --force switch (or, its shorthand, -f) to your git push command.

    Edited by Hadrien Benjamin Grasland
  • added 37 commits

    Compare with previous version

  • Thanks. Big red button pushed...

  • Hadrien Benjamin Grasland approved this merge request

    approved this merge request

  • Charles Leggett mentioned in commit 72f52a3d

    mentioned in commit 72f52a3d

  • Please register or sign in to reply
    Loading