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

[Bug]: GCC warns on multiple possible nullptr dereferences #4671

Open
jmacheta opened this issue Nov 27, 2024 · 0 comments
Open

[Bug]: GCC warns on multiple possible nullptr dereferences #4671

jmacheta opened this issue Nov 27, 2024 · 0 comments

Comments

@jmacheta
Copy link

jmacheta commented Nov 27, 2024

Describe the issue

When using relatively new GCC (14.2.0) with globally enabled both high optimization (-O3) and nullptr dereference warnings (-Wnull-dereference), the compiler issues multiple null dereferece warnings from within gtest target.

The problematic lines look as follows:

const TestSuite& test_suite = *unit_test.GetTestSuite(i);

or

test_suite.GetTestInfo(i)->is_reportable()

or

for (int test_index = 0; test_index < total_test_suite_count(); test_index++) {
  GetMutableSuiteCase(test_index)->Skip();
}

Indeed, GetTestInfo , GetTestSuite, GetMutableSuiteCase have a nullptr return path.

I don't believe that there is a way to make them return a nullptr with typical usage, however the compiler can't see through this and issues a warning.

Proposed solution

Add index assertions in GetTestInfo , GetTestSuite, GetMutableSuiteCase as presented in add_assertions.patch
(Please note that the patch changes the indice used in GetTestSuite to be more consistent with the use in GetTestSuite and GetMutableSuiteCase. The other reason is to avoid unused variable warning, when index < 0 check is removed.)

This fix won't work in Release builds (NDEBUG), so if this is concerning consider instrumenting the code at call site

Steps to reproduce the problem

  1. Download provided CMakeLists.txt
  2. cmake -B build -G Ninja             Configure with cmake
  3. cmake --build build -t gtest     Build gtest target

Expected output

[build] [4/8  50% :: 16.749] Building CXX object _deps/googletest-build/googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.obj
[build] In file included from X:/googletest_bug/build/_deps/googletest-src/googletest/src/gtest-all.cc:38:
[build] In member function 'bool testing::TestSuite::should_run() const',
[build]     inlined from 'static void testing::internal::PrettyUnitTestResultPrinter::PrintFailedTestSuites(const testing::UnitTest&)' at X:/googletest_bug/build/_deps/googletest-src/googletest/src/gtest.cc:3614:31:
[build] X:/googletest_bug/build/_deps/googletest-src/googletest/include/gtest/gtest.h:704:36: warning: potential null pointer dereference [-Wnull-dereference]
[build]   704 |   bool should_run() const { return should_run_; }
[build]       |                                    ^~~~~~~~~~~
[build] X:/googletest_bug/build/_deps/googletest-src/googletest/include/gtest/gtest.h:704:36: warning: potential null pointer dereference [-Wnull-dereference]
[build] In member function 'bool testing::TestSuite::should_run() const',
[build]     inlined from 'static void testing::internal::PrettyUnitTestResultPrinter::PrintSkippedTests(const testing::UnitTest&)' at X:/googletest_bug/build/_deps/googletest-src/googletest/src/gtest.cc:3638:31,
[build]     inlined from 'static void testing::internal::PrettyUnitTestResultPrinter::PrintSkippedTests(const testing::UnitTest&)' at X:/googletest_bug/build/_deps/googletest-src/googletest/src/gtest.cc:3630:6:
[build] X:/googletest_bug/build/_deps/googletest-src/googletest/include/gtest/gtest.h:704:36: warning: potential null pointer dereference [-Wnull-dereference]
[build]   704 |   bool should_run() const { return should_run_; }
[build]       |                                    ^~~~~~~~~~~
[build] X:/googletest_bug/build/_deps/googletest-src/googletest/include/gtest/gtest.h:704:36: warning: potential null pointer dereference [-Wnull-dereference]
[build] In member function 'bool testing::TestInfo::should_run() const',
[build]     inlined from 'static void testing::internal::PrettyUnitTestResultPrinter::PrintSkippedTests(const testing::UnitTest&)' at X:/googletest_bug/build/_deps/googletest-src/googletest/src/gtest.cc:3643:32,
[build]     inlined from 'static void testing::internal::PrettyUnitTestResultPrinter::PrintSkippedTests(const testing::UnitTest&)' at X:/googletest_bug/build/_deps/googletest-src/googletest/src/gtest.cc:3630:6:
[build] X:/googletest_bug/build/_deps/googletest-src/googletest/include/gtest/gtest.h:589:36: warning: potential null pointer dereference [-Wnull-dereference]
[build]   589 |   bool should_run() const { return should_run_; }
[build]       |                                    ^~~~~~~~~~~
[build] X:/googletest_bug/build/_deps/googletest-src/googletest/include/gtest/gtest.h:589:36: warning: potential null pointer dereference [-Wnull-dereference]
[build] In member function 'bool testing::TestSuite::should_run() const',
[build]     inlined from 'static void testing::internal::PrettyUnitTestResultPrinter::PrintFailedTests(const testing::UnitTest&)' at X:/googletest_bug/build/_deps/googletest-src/googletest/src/gtest.cc:3589:31:
[build] X:/googletest_bug/build/_deps/googletest-src/googletest/include/gtest/gtest.h:704:36: warning: potential null pointer dereference [-Wnull-dereference]
[build]   704 |   bool should_run() const { return should_run_; }
[build]       |                                    ^~~~~~~~~~~
[build] X:/googletest_bug/build/_deps/googletest-src/googletest/include/gtest/gtest.h:704:36: warning: potential null pointer dereference [-Wnull-dereference]
[build] In member function 'bool testing::TestInfo::should_run() const',
[build]     inlined from 'static void testing::internal::PrettyUnitTestResultPrinter::PrintFailedTests(const testing::UnitTest&)' at X:/googletest_bug/build/_deps/googletest-src/googletest/src/gtest.cc:3594:32:
[build] X:/googletest_bug/build/_deps/googletest-src/googletest/include/gtest/gtest.h:589:36: warning: potential null pointer dereference [-Wnull-dereference]
[build]   589 |   bool should_run() const { return should_run_; }
[build]       |                                    ^~~~~~~~~~~
[build] X:/googletest_bug/build/_deps/googletest-src/googletest/include/gtest/gtest.h:589:36: warning: potential null pointer dereference [-Wnull-dereference]
[build] In member function 'bool testing::TestInfo::is_reportable() const',
[build]     inlined from 'static void testing::internal::XmlUnitTestResultPrinter::PrintXmlTestSuite(std::ostream*, const testing::TestSuite&)' at X:/googletest_bug/build/_deps/googletest-src/googletest/src/gtest.cc:4379:49:
[build] X:/googletest_bug/build/_deps/googletest-src/googletest/include/gtest/gtest.h:595:12: warning: potential null pointer dereference [-Wnull-dereference]
[build]   595 |     return matches_filter_ && !is_in_another_shard_;
[build]       |            ^~~~~~~~~~~~~~~
[build] X:/googletest_bug/build/_deps/googletest-src/googletest/include/gtest/gtest.h:595:12: warning: potential null pointer dereference [-Wnull-dereference]
[build] In file included from D:/devel/win/toolchains/x86_64/14.2.0/mingw64/include/c++/14.2.0/bits/stl_algobase.h:67,
[build]                  from D:/devel/win/toolchains/x86_64/14.2.0/mingw64/include/c++/14.2.0/bits/stl_uninitialized.h:63,
[build]                  from D:/devel/win/toolchains/x86_64/14.2.0/mingw64/include/c++/14.2.0/memory:69,
[build]                  from X:/googletest_bug/build/_deps/googletest-src/googletest/include/gtest/gtest.h:55:
[build] In constructor '__gnu_cxx::__normal_iterator<_Iterator, _Container>::__normal_iterator(const _Iterator&) [with _Iterator = testing::TestInfo* const*; _Container = std::vector<testing::TestInfo*>]',
[build]     inlined from 'std::vector<_Tp, _Alloc>::const_iterator std::vector<_Tp, _Alloc>::end() const [with _Tp = testing::TestInfo*; _Alloc = std::allocator<testing::TestInfo*>]' at D:/devel/win/toolchains/x86_64/14.2.0/mingw64/include/c++/14.2.0/bits/stl_vector.h:904:16,
[build]     inlined from 'int testing::internal::CountIf(const Container&, Predicate) [with Container = std::vector<testing::TestInfo*>; Predicate = bool (*)(const testing::TestInfo*)]' at X:/googletest_bug/build/_deps/googletest-src/googletest/src/gtest-internal-inl.h:280:40,
[build]     inlined from 'int testing::TestSuite::reportable_test_count() const' at X:/googletest_bug/build/_deps/googletest-src/googletest/src/gtest.cc:2945:17,
[build]     inlined from 'static void testing::internal::XmlUnitTestResultPrinter::PrintXmlUnitTest(std::ostream*, const testing::UnitTest&)' at X:/googletest_bug/build/_deps/googletest-src/googletest/src/gtest.cc:4417:57:
[build] D:/devel/win/toolchains/x86_64/14.2.0/mingw64/include/c++/14.2.0/bits/stl_iterator.h:1068:9: warning: potential null pointer dereference [-Wnull-dereference]
[build]  1068 |       : _M_current(__i) { }
[build]       |         ^~~~~~~~~~~~~~~
[build] In constructor '__gnu_cxx::__normal_iterator<_Iterator, _Container>::__normal_iterator(const _Iterator&) [with _Iterator = testing::TestInfo* const*; _Container = std::vector<testing::TestInfo*>]',
[build]     inlined from 'std::vector<_Tp, _Alloc>::const_iterator std::vector<_Tp, _Alloc>::begin() const [with _Tp = testing::TestInfo*; _Alloc = std::allocator<testing::TestInfo*>]' at D:/devel/win/toolchains/x86_64/14.2.0/mingw64/include/c++/14.2.0/bits/stl_vector.h:884:16,
[build]     inlined from 'int testing::internal::CountIf(const Container&, Predicate) [with Container = std::vector<testing::TestInfo*>; Predicate = bool (*)(const testing::TestInfo*)]' at X:/googletest_bug/build/_deps/googletest-src/googletest/src/gtest-internal-inl.h:280:25,
[build]     inlined from 'int testing::TestSuite::reportable_test_count() const' at X:/googletest_bug/build/_deps/googletest-src/googletest/src/gtest.cc:2945:17,
[build]     inlined from 'static void testing::internal::XmlUnitTestResultPrinter::PrintXmlUnitTest(std::ostream*, const testing::UnitTest&)' at X:/googletest_bug/build/_deps/googletest-src/googletest/src/gtest.cc:4417:57:
[build] D:/devel/win/toolchains/x86_64/14.2.0/mingw64/include/c++/14.2.0/bits/stl_iterator.h:1068:9: warning: potential null pointer dereference [-Wnull-dereference]
[build]  1068 |       : _M_current(__i) { }
[build]       |         ^~~~~~~~~~~~~~~
[build] In constructor '__gnu_cxx::__normal_iterator<_Iterator, _Container>::__normal_iterator(const _Iterator&) [with _Iterator = testing::TestInfo* const*; _Container = std::vector<testing::TestInfo*>]',
[build]     inlined from 'std::vector<_Tp, _Alloc>::const_iterator std::vector<_Tp, _Alloc>::end() const [with _Tp = testing::TestInfo*; _Alloc = std::allocator<testing::TestInfo*>]' at D:/devel/win/toolchains/x86_64/14.2.0/mingw64/include/c++/14.2.0/bits/stl_vector.h:904:16,
[build]     inlined from 'int testing::internal::CountIf(const Container&, Predicate) [with Container = std::vector<testing::TestInfo*>; Predicate = bool (*)(const testing::TestInfo*)]' at X:/googletest_bug/build/_deps/googletest-src/googletest/src/gtest-internal-inl.h:280:40,
[build]     inlined from 'int testing::TestSuite::reportable_test_count() const' at X:/googletest_bug/build/_deps/googletest-src/googletest/src/gtest.cc:2945:17,
[build]     inlined from 'static void testing::internal::XmlUnitTestResultPrinter::PrintXmlUnitTest(std::ostream*, const testing::UnitTest&)' at X:/googletest_bug/build/_deps/googletest-src/googletest/src/gtest.cc:4417:57:
[build] D:/devel/win/toolchains/x86_64/14.2.0/mingw64/include/c++/14.2.0/bits/stl_iterator.h:1068:9: warning: potential null pointer dereference [-Wnull-dereference]
[build]  1068 |       : _M_current(__i) { }
[build]       |         ^~~~~~~~~~~~~~~
[build] In constructor '__gnu_cxx::__normal_iterator<_Iterator, _Container>::__normal_iterator(const _Iterator&) [with _Iterator = testing::TestInfo* const*; _Container = std::vector<testing::TestInfo*>]',
[build]     inlined from 'std::vector<_Tp, _Alloc>::const_iterator std::vector<_Tp, _Alloc>::begin() const [with _Tp = testing::TestInfo*; _Alloc = std::allocator<testing::TestInfo*>]' at D:/devel/win/toolchains/x86_64/14.2.0/mingw64/include/c++/14.2.0/bits/stl_vector.h:884:16,
[build]     inlined from 'int testing::internal::CountIf(const Container&, Predicate) [with Container = std::vector<testing::TestInfo*>; Predicate = bool (*)(const testing::TestInfo*)]' at X:/googletest_bug/build/_deps/googletest-src/googletest/src/gtest-internal-inl.h:280:25,
[build]     inlined from 'int testing::TestSuite::reportable_test_count() const' at X:/googletest_bug/build/_deps/googletest-src/googletest/src/gtest.cc:2945:17,
[build]     inlined from 'static void testing::internal::XmlUnitTestResultPrinter::PrintXmlUnitTest(std::ostream*, const testing::UnitTest&)' at X:/googletest_bug/build/_deps/googletest-src/googletest/src/gtest.cc:4417:57:
[build] D:/devel/win/toolchains/x86_64/14.2.0/mingw64/include/c++/14.2.0/bits/stl_iterator.h:1068:9: warning: potential null pointer dereference [-Wnull-dereference]
[build]  1068 |       : _M_current(__i) { }
[build]       |         ^~~~~~~~~~~~~~~
[build] In member function 'bool testing::TestInfo::is_reportable() const',
[build]     inlined from 'static void testing::internal::JsonUnitTestResultPrinter::PrintJsonTestSuite(std::ostream*, const testing::TestSuite&)' at X:/googletest_bug/build/_deps/googletest-src/googletest/src/gtest.cc:4845:49:
[build] X:/googletest_bug/build/_deps/googletest-src/googletest/include/gtest/gtest.h:595:12: warning: potential null pointer dereference [-Wnull-dereference]
[build]   595 |     return matches_filter_ && !is_in_another_shard_;
[build]       |            ^~~~~~~~~~~~~~~
[build] X:/googletest_bug/build/_deps/googletest-src/googletest/include/gtest/gtest.h:595:12: warning: potential null pointer dereference [-Wnull-dereference]
[build] In constructor '__gnu_cxx::__normal_iterator<_Iterator, _Container>::__normal_iterator(const _Iterator&) [with _Iterator = testing::TestInfo* const*; _Container = std::vector<testing::TestInfo*>]',
[build]     inlined from 'std::vector<_Tp, _Alloc>::const_iterator std::vector<_Tp, _Alloc>::end() const [with _Tp = testing::TestInfo*; _Alloc = std::allocator<testing::TestInfo*>]' at D:/devel/win/toolchains/x86_64/14.2.0/mingw64/include/c++/14.2.0/bits/stl_vector.h:904:16,
[build]     inlined from 'int testing::internal::CountIf(const Container&, Predicate) [with Container = std::vector<testing::TestInfo*>; Predicate = bool (*)(const testing::TestInfo*)]' at X:/googletest_bug/build/_deps/googletest-src/googletest/src/gtest-internal-inl.h:280:40,
[build]     inlined from 'int testing::TestSuite::reportable_test_count() const' at X:/googletest_bug/build/_deps/googletest-src/googletest/src/gtest.cc:2945:17,
[build]     inlined from 'static void testing::internal::JsonUnitTestResultPrinter::PrintJsonUnitTest(std::ostream*, const testing::UnitTest&)' at X:/googletest_bug/build/_deps/googletest-src/googletest/src/gtest.cc:4890:57:
[build] D:/devel/win/toolchains/x86_64/14.2.0/mingw64/include/c++/14.2.0/bits/stl_iterator.h:1068:9: warning: potential null pointer dereference [-Wnull-dereference]
[build]  1068 |       : _M_current(__i) { }
[build]       |         ^~~~~~~~~~~~~~~
[build] In constructor '__gnu_cxx::__normal_iterator<_Iterator, _Container>::__normal_iterator(const _Iterator&) [with _Iterator = testing::TestInfo* const*; _Container = std::vector<testing::TestInfo*>]',
[build]     inlined from 'std::vector<_Tp, _Alloc>::const_iterator std::vector<_Tp, _Alloc>::begin() const [with _Tp = testing::TestInfo*; _Alloc = std::allocator<testing::TestInfo*>]' at D:/devel/win/toolchains/x86_64/14.2.0/mingw64/include/c++/14.2.0/bits/stl_vector.h:884:16,
[build]     inlined from 'int testing::internal::CountIf(const Container&, Predicate) [with Container = std::vector<testing::TestInfo*>; Predicate = bool (*)(const testing::TestInfo*)]' at X:/googletest_bug/build/_deps/googletest-src/googletest/src/gtest-internal-inl.h:280:25,
[build]     inlined from 'int testing::TestSuite::reportable_test_count() const' at X:/googletest_bug/build/_deps/googletest-src/googletest/src/gtest.cc:2945:17,
[build]     inlined from 'static void testing::internal::JsonUnitTestResultPrinter::PrintJsonUnitTest(std::ostream*, const testing::UnitTest&)' at X:/googletest_bug/build/_deps/googletest-src/googletest/src/gtest.cc:4890:57:
[build] D:/devel/win/toolchains/x86_64/14.2.0/mingw64/include/c++/14.2.0/bits/stl_iterator.h:1068:9: warning: potential null pointer dereference [-Wnull-dereference]
[build]  1068 |       : _M_current(__i) { }
[build]       |         ^~~~~~~~~~~~~~~
[build] In constructor '__gnu_cxx::__normal_iterator<_Iterator, _Container>::__normal_iterator(const _Iterator&) [with _Iterator = testing::TestInfo* const*; _Container = std::vector<testing::TestInfo*>]',
[build]     inlined from 'std::vector<_Tp, _Alloc>::const_iterator std::vector<_Tp, _Alloc>::end() const [with _Tp = testing::TestInfo*; _Alloc = std::allocator<testing::TestInfo*>]' at D:/devel/win/toolchains/x86_64/14.2.0/mingw64/include/c++/14.2.0/bits/stl_vector.h:904:16,
[build]     inlined from 'int testing::internal::CountIf(const Container&, Predicate) [with Container = std::vector<testing::TestInfo*>; Predicate = bool (*)(const testing::TestInfo*)]' at X:/googletest_bug/build/_deps/googletest-src/googletest/src/gtest-internal-inl.h:280:40,
[build]     inlined from 'int testing::TestSuite::reportable_test_count() const' at X:/googletest_bug/build/_deps/googletest-src/googletest/src/gtest.cc:2945:17,
[build]     inlined from 'static void testing::internal::JsonUnitTestResultPrinter::PrintJsonUnitTest(std::ostream*, const testing::UnitTest&)' at X:/googletest_bug/build/_deps/googletest-src/googletest/src/gtest.cc:4890:57:
[build] D:/devel/win/toolchains/x86_64/14.2.0/mingw64/include/c++/14.2.0/bits/stl_iterator.h:1068:9: warning: potential null pointer dereference [-Wnull-dereference]
[build]  1068 |       : _M_current(__i) { }
[build]       |         ^~~~~~~~~~~~~~~
[build] In constructor '__gnu_cxx::__normal_iterator<_Iterator, _Container>::__normal_iterator(const _Iterator&) [with _Iterator = testing::TestInfo* const*; _Container = std::vector<testing::TestInfo*>]',
[build]     inlined from 'std::vector<_Tp, _Alloc>::const_iterator std::vector<_Tp, _Alloc>::begin() const [with _Tp = testing::TestInfo*; _Alloc = std::allocator<testing::TestInfo*>]' at D:/devel/win/toolchains/x86_64/14.2.0/mingw64/include/c++/14.2.0/bits/stl_vector.h:884:16,
[build]     inlined from 'int testing::internal::CountIf(const Container&, Predicate) [with Container = std::vector<testing::TestInfo*>; Predicate = bool (*)(const testing::TestInfo*)]' at X:/googletest_bug/build/_deps/googletest-src/googletest/src/gtest-internal-inl.h:280:25,
[build]     inlined from 'int testing::TestSuite::reportable_test_count() const' at X:/googletest_bug/build/_deps/googletest-src/googletest/src/gtest.cc:2945:17,
[build]     inlined from 'static void testing::internal::JsonUnitTestResultPrinter::PrintJsonUnitTest(std::ostream*, const testing::UnitTest&)' at X:/googletest_bug/build/_deps/googletest-src/googletest/src/gtest.cc:4890:57:
[build] D:/devel/win/toolchains/x86_64/14.2.0/mingw64/include/c++/14.2.0/bits/stl_iterator.h:1068:9: warning: potential null pointer dereference [-Wnull-dereference]
[build]  1068 |       : _M_current(__i) { }
[build]       |         ^~~~~~~~~~~~~~~
[build] In file included from X:/googletest_bug/build/_deps/googletest-src/googletest/src/gtest-all.cc:49:
[build] In member function 'void testing::TestSuite::Run()',
[build]     inlined from 'bool testing::internal::UnitTestImpl::RunAllTests()' at X:/googletest_bug/build/_deps/googletest-src/googletest/src/gtest.cc:5982:47:
[build] X:/googletest_bug/build/_deps/googletest-src/googletest/src/gtest.cc:3007:8: warning: potential null pointer dereference [-Wnull-dereference]
[build]  3007 |   if (!should_run_) return;
[build]       |        ^~~~~~~~~~~
[build] X:/googletest_bug/build/_deps/googletest-src/googletest/src/gtest.cc:3007:8: warning: potential null pointer dereference [-Wnull-dereference]
[build] In constructor '__gnu_cxx::__normal_iterator<_Iterator, _Container>::__normal_iterator(const _Iterator&) [with _Iterator = testing::TestInfo* const*; _Container = std::vector<testing::TestInfo*>]',
[build]     inlined from 'std::vector<_Tp, _Alloc>::const_iterator std::vector<_Tp, _Alloc>::end() const [with _Tp = testing::TestInfo*; _Alloc = std::allocator<testing::TestInfo*>]' at D:/devel/win/toolchains/x86_64/14.2.0/mingw64/include/c++/14.2.0/bits/stl_vector.h:904:16,
[build]     inlined from 'int testing::internal::CountIf(const Container&, Predicate) [with Container = std::vector<testing::TestInfo*>; Predicate = bool (*)(const testing::TestInfo*)]' at X:/googletest_bug/build/_deps/googletest-src/googletest/src/gtest-internal-inl.h:280:40,
[build]     inlined from 'int testing::TestSuite::failed_test_count() const' at X:/googletest_bug/build/_deps/googletest-src/googletest/src/gtest.cc:2930:17,
[build]     inlined from 'bool testing::TestSuite::Failed() const' at X:/googletest_bug/build/_deps/googletest-src/googletest/include/gtest/gtest.h:735:29,
[build]     inlined from 'bool testing::internal::UnitTestImpl::RunAllTests()' at X:/googletest_bug/build/_deps/googletest-src/googletest/src/gtest.cc:5984:54:
[build] D:/devel/win/toolchains/x86_64/14.2.0/mingw64/include/c++/14.2.0/bits/stl_iterator.h:1068:9: warning: potential null pointer dereference [-Wnull-dereference]
[build]  1068 |       : _M_current(__i) { }
[build]       |         ^~~~~~~~~~~~~~~
[build] In constructor '__gnu_cxx::__normal_iterator<_Iterator, _Container>::__normal_iterator(const _Iterator&) [with _Iterator = testing::TestInfo* const*; _Container = std::vector<testing::TestInfo*>]',
[build]     inlined from 'std::vector<_Tp, _Alloc>::const_iterator std::vector<_Tp, _Alloc>::begin() const [with _Tp = testing::TestInfo*; _Alloc = std::allocator<testing::TestInfo*>]' at D:/devel/win/toolchains/x86_64/14.2.0/mingw64/include/c++/14.2.0/bits/stl_vector.h:884:16,
[build]     inlined from 'int testing::internal::CountIf(const Container&, Predicate) [with Container = std::vector<testing::TestInfo*>; Predicate = bool (*)(const testing::TestInfo*)]' at X:/googletest_bug/build/_deps/googletest-src/googletest/src/gtest-internal-inl.h:280:25,
[build]     inlined from 'int testing::TestSuite::failed_test_count() const' at X:/googletest_bug/build/_deps/googletest-src/googletest/src/gtest.cc:2930:17,
[build]     inlined from 'bool testing::TestSuite::Failed() const' at X:/googletest_bug/build/_deps/googletest-src/googletest/include/gtest/gtest.h:735:29,
[build]     inlined from 'bool testing::internal::UnitTestImpl::RunAllTests()' at X:/googletest_bug/build/_deps/googletest-src/googletest/src/gtest.cc:5984:54:
[build] D:/devel/win/toolchains/x86_64/14.2.0/mingw64/include/c++/14.2.0/bits/stl_iterator.h:1068:9: warning: potential null pointer dereference [-Wnull-dereference]
[build]  1068 |       : _M_current(__i) { }
[build]       |         ^~~~~~~~~~~~~~~
[build] In constructor '__gnu_cxx::__normal_iterator<_Iterator, _Container>::__normal_iterator(const _Iterator&) [with _Iterator = testing::TestInfo* const*; _Container = std::vector<testing::TestInfo*>]',
[build]     inlined from 'std::vector<_Tp, _Alloc>::const_iterator std::vector<_Tp, _Alloc>::end() const [with _Tp = testing::TestInfo*; _Alloc = std::allocator<testing::TestInfo*>]' at D:/devel/win/toolchains/x86_64/14.2.0/mingw64/include/c++/14.2.0/bits/stl_vector.h:904:16,
[build]     inlined from 'int testing::internal::CountIf(const Container&, Predicate) [with Container = std::vector<testing::TestInfo*>; Predicate = bool (*)(const testing::TestInfo*)]' at X:/googletest_bug/build/_deps/googletest-src/googletest/src/gtest-internal-inl.h:280:40,
[build]     inlined from 'int testing::TestSuite::failed_test_count() const' at X:/googletest_bug/build/_deps/googletest-src/googletest/src/gtest.cc:2930:17,
[build]     inlined from 'bool testing::TestSuite::Failed() const' at X:/googletest_bug/build/_deps/googletest-src/googletest/include/gtest/gtest.h:735:29,
[build]     inlined from 'bool testing::internal::UnitTestImpl::RunAllTests()' at X:/googletest_bug/build/_deps/googletest-src/googletest/src/gtest.cc:5984:54:
[build] D:/devel/win/toolchains/x86_64/14.2.0/mingw64/include/c++/14.2.0/bits/stl_iterator.h:1068:9: warning: potential null pointer dereference [-Wnull-dereference]
[build]  1068 |       : _M_current(__i) { }
[build]       |         ^~~~~~~~~~~~~~~
[build] In constructor '__gnu_cxx::__normal_iterator<_Iterator, _Container>::__normal_iterator(const _Iterator&) [with _Iterator = testing::TestInfo* const*; _Container = std::vector<testing::TestInfo*>]',
[build]     inlined from 'std::vector<_Tp, _Alloc>::const_iterator std::vector<_Tp, _Alloc>::begin() const [with _Tp = testing::TestInfo*; _Alloc = std::allocator<testing::TestInfo*>]' at D:/devel/win/toolchains/x86_64/14.2.0/mingw64/include/c++/14.2.0/bits/stl_vector.h:884:16,
[build]     inlined from 'int testing::internal::CountIf(const Container&, Predicate) [with Container = std::vector<testing::TestInfo*>; Predicate = bool (*)(const testing::TestInfo*)]' at X:/googletest_bug/build/_deps/googletest-src/googletest/src/gtest-internal-inl.h:280:25,
[build]     inlined from 'int testing::TestSuite::failed_test_count() const' at X:/googletest_bug/build/_deps/googletest-src/googletest/src/gtest.cc:2930:17,
[build]     inlined from 'bool testing::TestSuite::Failed() const' at X:/googletest_bug/build/_deps/googletest-src/googletest/include/gtest/gtest.h:735:29,
[build]     inlined from 'bool testing::internal::UnitTestImpl::RunAllTests()' at X:/googletest_bug/build/_deps/googletest-src/googletest/src/gtest.cc:5984:54:
[build] D:/devel/win/toolchains/x86_64/14.2.0/mingw64/include/c++/14.2.0/bits/stl_iterator.h:1068:9: warning: potential null pointer dereference [-Wnull-dereference]
[build]  1068 |       : _M_current(__i) { }
[build]       |         ^~~~~~~~~~~~~~~
[build] In member function 'void testing::TestSuite::Skip()',
[build]     inlined from 'bool testing::internal::UnitTestImpl::RunAllTests()' at X:/googletest_bug/build/_deps/googletest-src/googletest/src/gtest.cc:5986:43:
[build] X:/googletest_bug/build/_deps/googletest-src/googletest/src/gtest.cc:3080:8: warning: potential null pointer dereference [-Wnull-dereference]
[build]  3080 |   if (!should_run_) return;
[build]       |        ^~~~~~~~~~~
[build] X:/googletest_bug/build/_deps/googletest-src/googletest/src/gtest.cc:3080:8: warning: potential null pointer dereference [-Wnull-dereference]
[build] In member function 'void testing::TestSuite::Skip()',
[build]     inlined from 'bool testing::internal::UnitTestImpl::RunAllTests()' at X:/googletest_bug/build/_deps/googletest-src/googletest/src/gtest.cc:5997:48:
[build] X:/googletest_bug/build/_deps/googletest-src/googletest/src/gtest.cc:3080:8: warning: potential null pointer dereference [-Wnull-dereference]
[build]  3080 |   if (!should_run_) return;
[build]       |        ^~~~~~~~~~~
[build] X:/googletest_bug/build/_deps/googletest-src/googletest/src/gtest.cc:3080:8: warning: potential null pointer dereference [-Wnull-dereference]

What version of GoogleTest are you using?

35d0c36

What operating system and version are you using?

Windows 11 24H2

What compiler and version are you using?

Using built-in specs.
COLLECT_GCC=<NOT IMPORTANT HERE>\mingw64\bin\c++.exe
COLLECT_LTO_WRAPPER=<NOT IMPORTANT HERE>/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/14.2.0/lto-wrapper.exe
OFFLOAD_TARGET_NAMES=nvptx-none
Target: x86_64-w64-mingw32
Configured with: ../configure --prefix=/R/winlibs64ucrt_stage/inst_gcc-14.2.0/share/gcc --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --enable-offload-targets=nvptx-none --with-pkgversion='MinGW-W64 x86_64-ucrt-posix-seh, built by Brecht Sanders, r1' --with-tune=generic --enable-checking=release --enable-threads=posix --disable-sjlj-exceptions --disable-libunwind-exceptions --disable-serial-configure --disable-bootstrap --enable-host-shared --enable-plugin --disable-default-ssp --disable-rpath --disable-libstdcxx-debug --disable-version-specific-runtime-libs --with-stabs --disable-symvers --enable-languages=c,c++,fortran,lto,objc,obj-c++ --disable-gold --disable-nls --disable-stage1-checking --disable-win32-registry --disable-multilib --enable-ld --enable-libquadmath --enable-libada --enable-libssp --enable-libstdcxx --enable-lto --enable-fully-dynamic-string --enable-libgomp --enable-graphite --enable-mingw-wildcard --enable-libstdcxx-time --enable-libstdcxx-pch --with-mpc=/d/Prog/winlibs64ucrt_stage/custombuilt --with-mpfr=/d/Prog/winlibs64ucrt_stage/custombuilt --with-gmp=/d/Prog/winlibs64ucrt_stage/custombuilt --with-isl=/d/Prog/winlibs64ucrt_stage/custombuilt --disable-libstdcxx-backtrace --enable-install-libiberty --enable-__cxa_atexit --without-included-gettext --with-diagnostics-color=auto --enable-clocale=generic --with-libiconv --with-system-zlib --with-build-sysroot=/R/winlibs64ucrt_stage/gcc-14.2.0/build_mingw/mingw-w64 CFLAGS='-D__USE_MINGW_ANSI_STDIO=0 -I/d/Prog/winlibs64ucrt_stage/custombuilt/include/libdl-win32   -march=nocona -msahf -mtune=generic -O2 -Wno-error=format' CXXFLAGS='-D__USE_MINGW_ANSI_STDIO=0 -Wno-int-conversion  -march=nocona -msahf -mtune=generic -O2' LDFLAGS='-pthread -Wl,--no-insert-timestamp -Wl,--dynamicbase -Wl,--high-entropy-va -Wl,--nxcompat -Wl,--tsaware' LD=/d/Prog/winlibs64ucrt_stage/custombuilt/share/binutils/bin/ld.exe
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.2.0 (MinGW-W64 x86_64-ucrt-posix-seh, built by Brecht Sanders, r1) 

toolchain download link: https://github.com/brechtsanders/winlibs_mingw/releases/download/14.2.0posix-18.1.8-12.0.0-ucrt-r1/winlibs-x86_64-posix-seh-gcc-14.2.0-llvm-18.1.8-mingw-w64ucrt-12.0.0-r1.7z

What build system are you using?

cmake version 3.30.5

CMake suite maintained and supported by Kitware (kitware.com/cmake).

Additional context

No response

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

No branches or pull requests

1 participant