Skip to content

Build fails when using GCC 12 #7663

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

Closed
esteffin opened this issue Apr 12, 2023 · 1 comment · Fixed by #7665
Closed

Build fails when using GCC 12 #7663

esteffin opened this issue Apr 12, 2023 · 1 comment · Fixed by #7665

Comments

@esteffin
Copy link
Contributor

CBMC build fails when using GCC 12 (latest version of GCC released in August 2022) on builds not using -O directives (meaning -O0).

Multiple new return-type warnings are produced when building with GCC 12.
This makes the build to fail as we use -Werror.

cbmc/src/util/interval.cpp: In static member function 'static exprt constant_interval_exprt::get_extreme(std::vector<exprt>, bool)':
cbmc/src/util/interval.cpp:567:1: error: control reaches end of non-void function [-Werror=return-type]
  567 | }
      | ^
cc1plus: all warnings being treated as errors
cbmc/src/util/simplify_expr_int.cpp: In member function 'simplify_exprt::resultt<> simplify_exprt::simplify_inequality_both_constant(const binary_relation_exprt&)':
cbmc/src/util/simplify_expr_int.cpp:1533:1: error: control reaches end of non-void function [-Werror=return-type]
 1533 | }
      | ^

It is possible that other files belonging to other submodules also fail, but the build failure stops the build earlier.

When building with CMake, it is possible to reproduce this by using Debug as CMAKE_BUILD_TYPE (cmake -DCMAKE_BUILD_TYPE=Debug ..).

Note that the error is not related with the addition of -DNDEBUG, but appears ONLY when -O0 is passed (or no -O directives are passed).

CBMC version: 5.80.0
Operating system: Ubuntu 22.04, MacOS, Fedora
Exact command line resulting in the issue: make
What behaviour did you expect: build succeed
What happened instead: build failure

@thomasspriggs
Copy link
Contributor

I think we should to tweak the implementation of our UNREACHABLE macro in order to make this error go-away. C23 introduces its own unreachable - https://en.cppreference.com/w/c/program/unreachable
We may be able to if def in a usage of gcc's __builtin_unreachable() when building with gcc.

@NlightNFotis NlightNFotis linked a pull request Apr 13, 2023 that will close this issue
7 tasks
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

Successfully merging a pull request may close this issue.

2 participants