Tpetra::CrsMatrix: Spurious build warning
Created by: mhoemmen
@bmpersc reported the following build warning with GCC 4.7.2. He thinks it is overly pedantic (and therefore likely spurious).
.../Tpetra_CrsMatrix_def.hpp: In member function ‘typename std::enable_if<std::is_same<TagType, void>::value>::type Kokkos::Impl::ParallelReduce<FunctorType, Kokkos::RangePolicy<Traits ...>, Kokkos::Serial>::exec(Kokkos::Impl::ParallelReduce<FunctorType, Kokkos::RangePolicy<Traits ...>, Kokkos::Serial>::pointer_type) const [with TagType = void; FunctorType = Tpetra::CrsMatrix<S, LO, GO, N, isClassic>::getLocalDiagCopy(Tpetra::Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node, classic>&) const [with Scalar = int; LocalOrdinal = int; GlobalOrdinal = long int; Node = Kokkos::Compat::KokkosDeviceWrapperNodeKokkos::Serial; bool classic = false]::<lambda(const LO&, LO&)>; Traits = {Kokkos::Serial, int}; typename std::enable_if<std::is_same<TagType, void>::value>::type = void; Kokkos::Impl::ParallelReduce<FunctorType, Kokkos::RangePolicy<Traits ...>, Kokkos::Serial>::pointer_type = int*]’: .../Tpetra_CrsMatrix_def.hpp:3395:52: error: ‘sorted’ may be used uninitialized in this function [-Werror=uninitialized] .../Tpetra_CrsMatrix_def.hpp:3377:18: note: ‘sorted’ was declared here cc1plus: all warnings being treated as errors
This is likely a compiler issue with lambdas. @bmpersc tried using GCC pragmas to disable the warning, but that didn't work. This is a blocker for some customers that build with warnings as errors and with ETI OFF (so that they actually see the _def.hpp files in their code).
This depends on #500 (closed). #500 (closed) will let us make the function in question thread parallel.
Work-around: rewrite to use a functor instead of a lambda.