DARMA-tasking / vt

DARMA/vt => Virtual Transport
Other
35 stars 9 forks source link

Fix compiler warnings with gcc-9.2 (specifically) #457

Closed lifflander closed 5 years ago

lifflander commented 5 years ago

Describe the bug

This happens in the context of EMPIRE using VT, but seems to stem from VT code and FMT (TPL in VT).

/ascldap/users/rppawlo/empire/EMPIRE/TPL/vt/src/vt/messaging/active.impl.h: In instantiation of ‘vt::messaging::ActiveMessenger::PendingSendType vt::messaging::ActiveMessenger::sendMsgSz(const NodeType&, MessageT*, const ByteType&, const TagType&) [with MessageT = vt::group::GroupMsg<vt::messaging::ActiveMsg<vt::messaging::EpochTagActiveEnvelope> >; void (* f)(MessageT*) = vt::group::InfoColl::newTreeHan; vt::messaging::ActiveMessenger::PendingSendType = vt::messaging::PendingSend; vt::NodeType = short int; vt::ByteType = long unsigned int; vt::TagType = int]’:
/ascldap/users/rppawlo/empire/EMPIRE/TPL/vt/src/vt/messaging/active.impl.h:171:64:   required from ‘vt::messaging::ActiveMessenger::PendingSendType vt::messaging::ActiveMessenger::sendMsg(const NodeType&, MessageT*, const TagType&) [with MessageT = vt::group::GroupMsg<vt::messaging::ActiveMsg<vt::messaging::EpochTagActiveEnvelope> >; void (* f)(MessageT*) = vt::group::InfoColl::newTreeHan; vt::messaging::ActiveMessenger::PendingSendType = vt::messaging::PendingSend; vt::NodeType = short int; vt::TagType = int]’
/ascldap/users/rppawlo/empire/EMPIRE/TPL/vt/src/vt/group/collective/group_collective_finished.cc:71:5:   required from here
/ascldap/users/rppawlo/empire/EMPIRE/TPL/vt/src/vt/messaging/active.impl.h:193:63: error: non-type template parameters of class type only available with ‘-std=c++2a’ or ‘-std=gnu++2a’
  193 |   auto const& han = auto_registry::makeAutoHandler<MessageT,f>(msg);
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
cc1plus: all warnings being treated as errors
[15/948] Building CXX object TPL/vt/src/CMakeFiles/vt.dir/vt/group/rooted/group_info_rooted.cc.o
FAILED: TPL/vt/src/CMakeFiles/vt.dir/vt/group/rooted/group_info_rooted.cc.o 
/ascldap/users/rppawlo/install-tpls/gcc-9.2.0/openmpi/4.0.1/bin/mpicxx  -DDISABLE_TPL_CHECKPOINT=0 -DEMPIRE_CHECK_FPE -DFMT_HEADER_ONLY=1 -DHAS_DETECTION_COMPONENT=1 -DKOKKOS_ENABLED_SERDES=1 -I/ascldap/users/rppawlo/install-tpls/gcc-9.2.0/zlib/1.2.11/include -I/ascldap/users/rppawlo/empire/EMPIRE/TPL/vt/lib/fmt -I/ascldap/users/rppawlo/empire/EMPIRE/TPL/vt/lib/CLI -ITPL/vt/release -I/ascldap/users/rppawlo/empire/EMPIRE/TPL/vt/src -I/ascldap/users/rppawlo/empire/EMPIRE/TPL/vt/lib/context/src -I. -I/ascldap/users/rppawlo/empire/EMPIRE/TPL/checkpoint/src -I/ascldap/users/rppawlo/empire/EMPIRE/TPL/detector/src -isystem /ascldap/users/rppawlo/tpls/trilinos/drekar-shared-opt/lib/cmake/Kokkos/../../../include -pedantic -Wall -Wno-long-long -Wwrite-strings -g -Wshadow -fdiagnostics-color=always -ansi -Wno-deprecated-declarations --std=c++11 -march=core-avx2 -mtune=core-avx2 -mrtm -fopenmp -O0 -Wall -Wshadow -Wunused-variable -pedantic -Wno-unknown-pragmas -Wno-narrowing -Wno-format -Werror -DTEUCHOS_DEPRECATED= -DTPETRA_DEPRECATED= -O3 -DNDEBUG   -std=c++1y -fPIC -fopenmp -std=gnu++14 -MD -MT TPL/vt/src/CMakeFiles/vt.dir/vt/group/rooted/group_info_rooted.cc.o -MF TPL/vt/src/CMakeFiles/vt.dir/vt/group/rooted/group_info_rooted.cc.o.d -o TPL/vt/src/CMakeFiles/vt.dir/vt/group/rooted/group_info_rooted.cc.o -c /ascldap/users/rppawlo/empire/EMPIRE/TPL/vt/src/vt/group/rooted/group_info_rooted.cc
In file included from /ascldap/users/rppawlo/empire/EMPIRE/TPL/vt/src/vt/configs/debug/debug_print.h:52,
                 from /ascldap/users/rppawlo/empire/EMPIRE/TPL/vt/src/vt/configs/debug/debug_masterconfig.h:59,
                 from /ascldap/users/rppawlo/empire/EMPIRE/TPL/vt/src/vt/config.h:48,
                 from /ascldap/users/rppawlo/empire/EMPIRE/TPL/vt/src/vt/group/rooted/group_info_rooted.cc:45:
/ascldap/users/rppawlo/empire/EMPIRE/TPL/vt/lib/fmt/fmt/format.h:3632:55: error: ISO C++ did not adopt string literal operator templates taking an argument pack of characters [-Werror=pedantic]
 3632 | FMT_CONSTEXPR internal::udl_formatter<Char, CHARS...> operator""_format() {
      |                                                       ^~~~~~~~
In file included from /ascldap/users/rppawlo/empire/EMPIRE/TPL/vt/src/vt/utils/demangle/demangle.h:51,
                 from /ascldap/users/rppawlo/empire/EMPIRE/TPL/vt/src/vt/registry/auto/auto_registry_general_impl.h:49,
                 from /ascldap/users/rppawlo/empire/EMPIRE/TPL/vt/src/vt/registry/auto/auto_registry_general.h:117,
                 from /ascldap/users/rppawlo/empire/EMPIRE/TPL/vt/src/vt/registry/auto/auto_registry.h:50,
                 from /ascldap/users/rppawlo/empire/EMPIRE/TPL/vt/src/vt/registry/auto/auto_registry_interface.h:75,
                 from /ascldap/users/rppawlo/empire/EMPIRE/TPL/vt/src/vt/messaging/active.h:60,
                 from /ascldap/users/rppawlo/empire/EMPIRE/TPL/vt/src/vt/group/rooted/group_info_rooted.cc:55:
/ascldap/users/rppawlo/empire/EMPIRE/TPL/vt/src/vt/utils/demangle/demangled_name.h: In constructor ‘vt::util::demangle::DemangledName::DemangledName(const string&, const string&, const string&)’:
/ascldap/users/rppawlo/empire/EMPIRE/TPL/vt/src/vt/utils/demangle/demangled_name.h:60:5: error: declaration of ‘in_func’ shadows a global declaration [-Werror=shadow]
   60 |   { }
      |     ^

To Reproduce Steps to reproduce the behavior:

  1. Build with gcc 9.2
lifflander commented 5 years ago

Cross-referenced: https://cee-gitlab.sandia.gov/EM-Plasma/EMPIRE/issues/1018

lifflander commented 5 years ago

The fmt related problem is discussed in this issue: https://github.com/citra-emu/citra/issues/4766

lifflander commented 5 years ago

I think that the compiler warning about non-type, class templates is bug. VT does not us any class non-type templates because they are not C++11 compatible. The error is on a function pointer non-type which is allowed:

/Users/jliffla/codes/vt/virtual-transport/src/vt/messaging/active.impl.h: In instantiation of 'vt::messaging::ActiveMessenger::PendingSendType vt::messaging::ActiveMessenger::sendMsgSz(const NodeType&, MessageT*, const ByteType&, const TagType&) [with MessageT = vt::collective::barrier::BarrierMsg; void (* f)(MessageT*) = vt::collective::barrier::Barrier::barrierUp; vt::messaging::ActiveMessenger::PendingSendType = vt::messaging::PendingSend; vt::NodeType = short int; vt::ByteType = long long unsigned int; vt::TagType = int]':
/Users/jliffla/codes/vt/virtual-transport/src/vt/messaging/active.impl.h:171:64:   required from 'vt::messaging::ActiveMessenger::PendingSendType vt::messaging::ActiveMessenger::sendMsg(const NodeType&, MessageT*, const TagType&) [with MessageT = vt::collective::barrier::BarrierMsg; void (* f)(MessageT*) = vt::collective::barrier::Barrier::barrierUp; vt::messaging::ActiveMessenger::PendingSendType = vt::messaging::PendingSend; vt::NodeType = short int; vt::TagType = int]'
/Users/jliffla/codes/vt/virtual-transport/src/vt/collective/barrier/barrier.cc:224:59:   required from here
/Users/jliffla/codes/vt/virtual-transport/src/vt/messaging/active.impl.h:193:63: error: non-type template parameters of class type only available with '-std=c++2a' or '-std=gnu++2a'
  193 |   auto const& han = auto_registry::makeAutoHandler<MessageT,f>(msg);
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
/Users/jliffla/codes/vt/virtual-transport/src/vt/messaging/active.impl.h: In instantiation of 'vt::messaging::ActiveMessenger::PendingSendType vt::messaging::ActiveMessenger::broadcastMsgSz(MessageT*, const ByteType&, const TagType&) [with MessageT = vt::collective::barrier::BarrierMsg; void (* f)(MessageT*) = vt::collective::barrier::Barrier::barrierDown; vt::messaging::ActiveMessenger::PendingSendType = vt::messaging::PendingSend; vt::ByteType = long long unsigned int; vt::TagType = int]':
/Users/jliffla/codes/vt/virtual-transport/src/vt/messaging/active.impl.h:164:61:   required from 'vt::messaging::ActiveMessenger::PendingSendType vt::messaging::ActiveMessenger::broadcastMsg(MessageT*, const TagType&) [with MessageT = vt::collective::barrier::BarrierMsg; void (* f)(MessageT*) = vt::collective::barrier::Barrier::barrierDown; vt::messaging::ActiveMessenger::PendingSendType = vt::messaging::PendingSend; vt::TagType = int]'
/Users/jliffla/codes/vt/virtual-transport/src/vt/collective/barrier/barrier.cc:235:58:   required from here
/Users/jliffla/codes/vt/virtual-transport/src/vt/messaging/active.impl.h:151:63: error: non-type template parameters of class type only available with '-std=c++2a' or '-std=gnu++2a'
  151 |   auto const& han = auto_registry::makeAutoHandler<MessageT,f>(msg);
      |                     ~~~~~~~~~~~~~~~~
nmm0 commented 5 years ago

@lifflander This is a bug in gcc 9.1 and 9.2. I ran into this issue a little while back but I must have forgotten to submit a patch. The VT code that triggers the bug is this:

template <typename MessageT, ActiveTypedFnType<MessageT>* f>
HandlerType makeAutoHandler(MessageT* const msg);

template <typename T, T value>
HandlerType makeAutoHandler();

When GCC sees makeAutoHandler< MessageT, f >( msg ) it incorrectly tries to match the template parameter of both versions of the function, even though only the first one is in the valid overload set. It then checks the validity of the template parameters and fails on the second because it tries to instantiate a non-type template parameter of MessageT one even though it shouldn't be checking that in the first place. I'll submit a pull request with a workaround which is just renaming the second overload.

pnstickne commented 5 years ago

@nmm0 Have branch/PR for fix wrt naming changes? (Orphan ticket at this point?)

pnstickne commented 5 years ago

Hmm. Commits work better with reference #'s .. added tags and moved to new branch.

pnstickne commented 5 years ago

Pulling the epoch changes out of branch-scope in future PR (should be separate story, merge conflicts with other changes).

lifflander commented 5 years ago

Merged, closing.