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

Compilation error when using g++ 11.2.0 with release-1.10.0 #3835

Closed
jparisu opened this issue May 13, 2022 · 2 comments
Closed

Compilation error when using g++ 11.2.0 with release-1.10.0 #3835

jparisu opened this issue May 13, 2022 · 2 comments
Labels

Comments

@jparisu
Copy link

jparisu commented May 13, 2022

Describe the bug

This CMake project fails in compilation when g++ 11.2.0 is used (default g++ in Ubuntu 22.04) with version release-1.10.0
It fails for a uninitialized variable.

Steps to reproduce the bug

  • Use Ubuntu 22.04 (ubuntu:latest in Dockerhub)
  • download repository googletest (by clone)
  • switch to tag: release-1.10.0
  • compile project

The following error arises:

In file included from /home/wks/src/googletest-distribution/googletest/src/gtest-all.cc:42:
/home/wks/src/googletest-distribution/googletest/src/gtest-death-test.cc: In function ‘bool testing::internal::StackGrowsDown()’:
/home/wks/src/googletest-distribution/googletest/src/gtest-death-test.cc:1301:24: error: ‘dummy’ may be used uninitialized [-Werror=maybe-uninitialized]
 1301 |   StackLowerThanAddress(&dummy, &result);
      |   ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/home/wks/src/googletest-distribution/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/wks/src/googletest-distribution/googletest/src/gtest-death-test.cc:1299:7: note: ‘dummy’ declared here
 1299 |   int dummy;
      |       ^~~~~
cc1plus: all warnings being treated as errors
gmake[2]: *** [googletest/CMakeFiles/gtest.dir/build.make:76: googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:172: googletest/CMakeFiles/gtest.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2

Does the bug persist in the most recent commit?

It does not. But we use version release-1.10.0 due to some errors that we encountered when updating to new versions.

What operating system and version are you using?

Ubuntu 22.04 LTS

What compiler and version are you using?

g++ (Ubuntu 11.2.0-19ubuntu1) 11.2.0

What build system are you using?

cmake version 3.22.1
We are using colcon, ROS 2 superbuild tool.
https://colcon.readthedocs.io/en/released/

Additional context

The fix is very simple, and if your team give me positive feedback I could prepare a PR to fix it.

@jparisu jparisu added the bug label May 13, 2022
@dinord
Copy link
Collaborator

dinord commented May 16, 2022

We do not plan to patch 1.10 other than for exceptional circumstances, such as security issues. Please try using a newer version of GoogleTest.
And if that is not an option, please let us know why.

@dinord dinord closed this as completed May 16, 2022
runejuhl added a commit to runejuhl/pgp-packet-library that referenced this issue Jul 7, 2022
Fixes compilation error when compiling with g++ 11.2.0 or above; see google/googletest#3835.
runejuhl added a commit to runejuhl/pgp-packet-library that referenced this issue Jul 7, 2022
Fixes compilation error when compiling with g++ 11.2.0 or above; see google/googletest#3835.
@chris-pattern
Copy link

Resolved by 4679637

proatgram added a commit to proatgram/securemessage that referenced this issue May 15, 2023
Fixes build issue with googletest documented in [this issue](google/googletest#3835) where the build would fail with a maybe uninitialized error. This commit should bring the changes that fixed the issue in gtest to the submodule in this repository.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants