diff --git a/include/alpaka/test/KernelExecutionFixture.hpp b/include/alpaka/test/KernelExecutionFixture.hpp index 954cadbb31f6..8d783be62186 100644 --- a/include/alpaka/test/KernelExecutionFixture.hpp +++ b/include/alpaka/test/KernelExecutionFixture.hpp @@ -1,4 +1,4 @@ -/* Copyright 2022 Benjamin Worpitz, Andrea Bocci, Bernhard Manfred Gruber +/* Copyright 2023 Benjamin Worpitz, Andrea Bocci, Bernhard Manfred Gruber, Jan Stephan * SPDX-License-Identifier: MPL-2.0 */ @@ -25,6 +25,13 @@ namespace alpaka::test template class KernelExecutionFixture { +#if defined(BOOST_COMP_GNUC) && BOOST_COMP_GNUC >= BOOST_VERSION_NUMBER(11, 0, 0) \ + && BOOST_COMP_GNUC < BOOST_VERSION_NUMBER(12, 0, 0) +// g++-11 (wrongly) believes that m_platformHost is used in an uninitialized state. +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wmaybe-uninitialized" +#endif + public: using Acc = TAcc; using Dim = alpaka::Dim; @@ -34,25 +41,18 @@ namespace alpaka::test using Queue = test::DefaultQueue; using WorkDiv = WorkDivMembers; - KernelExecutionFixture(WorkDiv workDiv) - : m_devHost{getDevByIdx(m_platformHost, 0)} - , m_device{getDevByIdx(m_platform, 0)} - , m_queue{m_device} - , m_workDiv{std::move(workDiv)} + KernelExecutionFixture(WorkDiv workDiv) : m_workDiv{std::move(workDiv)} { } template KernelExecutionFixture(TExtent const& extent) - : m_devHost{getDevByIdx(m_platformHost, 0)} - , m_device{getDevByIdx(m_platform, 0)} - , m_queue{m_device} - , m_workDiv{getValidWorkDiv( - m_device, - extent, - Vec::ones(), - false, - GridBlockExtentSubDivRestrictions::Unrestricted)} + : m_workDiv{getValidWorkDiv( + m_device, + extent, + Vec::ones(), + false, + GridBlockExtentSubDivRestrictions::Unrestricted)} { } @@ -76,11 +76,15 @@ namespace alpaka::test } private: - PlatformCpu m_platformHost; - DevCpu m_devHost; - Platform m_platform; - Device m_device; - Queue m_queue; + PlatformCpu m_platformHost{}; + DevCpu m_devHost{getDevByIdx(m_platformHost, 0)}; + Platform m_platform{}; + Device m_device{getDevByIdx(m_platform, 0)}; + Queue m_queue{m_device}; WorkDiv m_workDiv; +#if defined(BOOST_COMP_GNUC) && BOOST_COMP_GNUC >= BOOST_VERSION_NUMBER(11, 0, 0) \ + && BOOST_COMP_GNUC < BOOST_VERSION_NUMBER(12, 0, 0) +# pragma GCC diagnostic pop +#endif }; } // namespace alpaka::test diff --git a/include/alpaka/test/queue/QueueTestFixture.hpp b/include/alpaka/test/queue/QueueTestFixture.hpp index d2c755976e9c..3f6e57160f0d 100644 --- a/include/alpaka/test/queue/QueueTestFixture.hpp +++ b/include/alpaka/test/queue/QueueTestFixture.hpp @@ -1,4 +1,4 @@ -/* Copyright 2019 Benjamin Worpitz +/* Copyright 2023 Benjamin Worpitz, Jan Stephan * SPDX-License-Identifier: MPL-2.0 */ @@ -12,16 +12,24 @@ namespace alpaka::test template struct QueueTestFixture { +#if defined(BOOST_COMP_GNUC) && BOOST_COMP_GNUC >= BOOST_VERSION_NUMBER(11, 0, 0) \ + && BOOST_COMP_GNUC < BOOST_VERSION_NUMBER(12, 0, 0) +// g++-11 (wrongly) believes that m_platform is used in an uninitialized state. +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wmaybe-uninitialized" +#endif using Dev = std::tuple_element_t<0, TDevQueue>; using Queue = std::tuple_element_t<1, TDevQueue>; using Platform = alpaka::Platform; - QueueTestFixture() : m_dev(getDevByIdx(m_platform, 0)), m_queue(m_dev) - { - } + QueueTestFixture() = default; - Platform m_platform; - Dev m_dev; - Queue m_queue; + Platform m_platform{}; + Dev m_dev{getDevByIdx(m_platform, 0)}; + Queue m_queue{m_dev}; +#if defined(BOOST_COMP_GNUC) && BOOST_COMP_GNUC >= BOOST_VERSION_NUMBER(11, 0, 0) \ + && BOOST_COMP_GNUC < BOOST_VERSION_NUMBER(12, 0, 0) +# pragma GCC diagnostic pop +#endif }; } // namespace alpaka::test diff --git a/test/unit/mem/copy/src/BufSlicing.cpp b/test/unit/mem/copy/src/BufSlicing.cpp index f3a2374b1143..f690acd7e8e9 100644 --- a/test/unit/mem/copy/src/BufSlicing.cpp +++ b/test/unit/mem/copy/src/BufSlicing.cpp @@ -1,4 +1,4 @@ -/* Copyright 2023 Axel Huebl, Benjamin Worpitz, Jakob Krude, Bernhard Manfred Gruber, Jan Stephan, Andrea Bocci +/* Copyright 2023 Axel Hübl, Benjamin Worpitz, Jakob Krude, Bernhard Manfred Gruber, Jan Stephan, Andrea Bocci * SPDX-License-Identifier: MPL-2.0 */ @@ -20,6 +20,12 @@ template> struct TestContainer { +#if defined(BOOST_COMP_GNUC) && BOOST_COMP_GNUC >= BOOST_VERSION_NUMBER(11, 0, 0) \ + && BOOST_COMP_GNUC < BOOST_VERSION_NUMBER(12, 0, 0) +// g++-11 (wrongly) believes that platformHost is used in an uninitialized state. +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wmaybe-uninitialized" +#endif using AccQueueProperty = alpaka::Blocking; using DevQueue = alpaka::Queue; using DevAcc = alpaka::Dev; @@ -33,19 +39,13 @@ struct TestContainer using SubView = alpaka::ViewSubView; - PlatformAcc const platformAcc{}; - DevAcc const devAcc; - PlatformHost const platformHost{}; - DevHost const devHost; - DevQueue devQueue; - - // Constructor - TestContainer() - : devAcc(alpaka::getDevByIdx(platformAcc, 0)) - , devHost(alpaka::getDevByIdx(platformHost, 0u)) - , devQueue(devAcc) - { - } + PlatformAcc platformAcc{}; + DevAcc devAcc{alpaka::getDevByIdx(platformAcc, 0)}; + PlatformHost platformHost{}; + DevHost devHost{alpaka::getDevByIdx(platformHost, 0u)}; + DevQueue devQueue{devAcc}; + + TestContainer() = default; auto createHostBuffer(Vec extents, bool indexed) -> BufHost { @@ -108,6 +108,10 @@ struct TestContainer REQUIRE(ptrA[i] == Catch::Approx(ptrB[i])); } } +#if defined(BOOST_COMP_GNUC) && BOOST_COMP_GNUC >= BOOST_VERSION_NUMBER(11, 0, 0) \ + && BOOST_COMP_GNUC < BOOST_VERSION_NUMBER(12, 0, 0) +# pragma GCC diagnostic pop +#endif }; using DataTypes = std::tuple;