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

error: ‘dummy’ may be used uninitialized #1346

Open
y2k0999 opened this issue Mar 3, 2025 · 0 comments
Open

error: ‘dummy’ may be used uninitialized #1346

y2k0999 opened this issue Mar 3, 2025 · 0 comments

Comments

@y2k0999
Copy link

y2k0999 commented Mar 3, 2025

[ 55%] Building CXX object test/prefix/googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.o
In file included from /home/gh/throw/yaml_test/yaml-cpp-yaml-cpp-0.7.0/test/gtest-1.10.0/googletest/src/gtest-all.cc:42:
/home/gh/throw/yaml_test/yaml-cpp-yaml-cpp-0.7.0/test/gtest-1.10.0/googletest/src/gtest-death-test.cc: In function ‘bool testing::internal::StackGrowsDown()’:
/home/gh/throw/yaml_test/yaml-cpp-yaml-cpp-0.7.0/test/gtest-1.10.0/googletest/src/gtest-death-test.cc:1301:24: error: ‘dummy’ may be used uninitialized [-Werror=maybe-uninitialized]
 1301 |   StackLowerThanAddress(&dummy, &result);
      |   ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/home/gh/throw/yaml_test/yaml-cpp-yaml-cpp-0.7.0/test/gtest-1.10.0/googletest/src/gtest-death-test.cc:1290:13: note: by argument 1 of type ‘const void*’ to ‘void testing::internal::StackLowerThanAddress(const void*, bool*)’ declared here
 1290 | static void StackLowerThanAddress(const void* ptr, bool* result) {
      |             ^~~~~~~~~~~~~~~~~~~~~
/home/gh/throw/yaml_test/yaml-cpp-yaml-cpp-0.7.0/test/gtest-1.10.0/googletest/src/gtest-death-test.cc:1299:7: note: ‘dummy’ declared here
 1299 |   int dummy;
      |       ^~~~~
cc1plus: all warnings being treated as errors
make[2]: *** [test/prefix/googletest/CMakeFiles/gtest.dir/build.make:76: test/prefix/googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1038: test/prefix/googletest/CMakeFiles/gtest.dir/all] Error 2
make: *** [Makefile:146: all] Error 2

I had to go into yaml_test/yaml-cpp-yaml-cpp-0.7.0/test/gtest-1.10.0/googletest/src/gtest-death-test.cc and change line 1299
int dummy;
into
int dummy = 0;
then this issue went away. I suppose I could ignore warnings as well but whatever.

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