Skip to content

Commit 560a588

Browse files
committed
Add support for building with GCC 14
GCC 14 adds new warnings. Those are largely spurious (perhaps with exception of the interpreter code and unit tests), but still require working around. These warnings also affect CaDiCaL builds, which in turn requires us to upgrade to version 2.0.0, where workarounds have been added. Fixes: #7749
1 parent 66ae03f commit 560a588

File tree

23 files changed

+124
-74
lines changed

23 files changed

+124
-74
lines changed

.github/workflows/pull-request-checks.yaml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ jobs:
399399
run: cd build; ctest . -V -L CORE -j${{env.linux-vcpus}}
400400

401401
# This job takes approximately 14 to 46 minutes
402-
check-ubuntu-24_04-cmake-gcc-13:
402+
check-ubuntu-24_04-cmake-gcc-14:
403403
runs-on: ubuntu-24.04
404404
steps:
405405
- uses: actions/checkout@v4
@@ -412,13 +412,13 @@ jobs:
412412
DEBIAN_FRONTEND: noninteractive
413413
run: |
414414
sudo apt-get update
415-
sudo apt-get install --no-install-recommends -yq cmake ninja-build gcc-13 gdb g++-13 maven flex bison libxml2-utils dpkg-dev ccache doxygen z3
415+
sudo apt-get install --no-install-recommends -yq cmake ninja-build gcc-14 gdb g++-14 maven flex bison libxml2-utils dpkg-dev ccache doxygen z3
416416
# Update symlinks so that any use of gcc (including our regression
417-
# tests) will use GCC 13.
418-
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 110 \
419-
--slave /usr/bin/g++ g++ /usr/bin/g++-13 \
420-
--slave /usr/bin/gcov gcov /usr/bin/gcov-13
421-
sudo ln -sf cpp-13 /usr/bin/cpp
417+
# tests) will use GCC 14.
418+
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 110 \
419+
--slave /usr/bin/g++ g++ /usr/bin/g++-14 \
420+
--slave /usr/bin/gcov gcov /usr/bin/gcov-14
421+
sudo ln -sf cpp-14 /usr/bin/cpp
422422
- name: Confirm z3 solver is available and log the version installed
423423
run: z3 --version
424424
- name: Download cvc-5 from the releases page and make sure it can be deployed
@@ -432,10 +432,10 @@ jobs:
432432
with:
433433
save-always: true
434434
path: .ccache
435-
key: ${{ runner.os }}-24.04-Release-gcc-13-${{ github.ref }}-${{ github.sha }}-PR
435+
key: ${{ runner.os }}-24.04-Release-gcc-14-${{ github.ref }}-${{ github.sha }}-PR
436436
restore-keys: |
437-
${{ runner.os }}-24.04-Release-gcc-13-${{ github.ref }}
438-
${{ runner.os }}-24.04-Release-gcc-13
437+
${{ runner.os }}-24.04-Release-gcc-14-${{ github.ref }}
438+
${{ runner.os }}-24.04-Release-gcc-14
439439
- name: ccache environment
440440
run: |
441441
echo "CCACHE_BASEDIR=$PWD" >> $GITHUB_ENV

jbmc/src/java_bytecode/assignments_from_json.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -641,8 +641,9 @@ static code_with_references_listt assign_enum_from_json(
641641

642642
dereference_exprt values_struct{
643643
info.symbol_table.lookup_ref(values_name).symbol_expr()};
644-
const auto &values_struct_type = namespacet{info.symbol_table}.follow_tag(
645-
to_struct_tag_type(values_struct.type()));
644+
const namespacet ns{info.symbol_table};
645+
const auto &values_struct_type =
646+
ns.follow_tag(to_struct_tag_type(values_struct.type()));
646647
PRECONDITION(is_valid_java_array(values_struct_type));
647648
const member_exprt values_data = member_exprt{
648649
values_struct, "data", values_struct_type.components()[2].type()};

jbmc/src/java_bytecode/java_utils.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,11 @@ bool is_non_null_library_global(const irep_idt &);
164164

165165
extern const std::unordered_set<std::string> cprover_methods_to_ignore;
166166

167-
symbolt &fresh_java_symbol(
167+
#if defined(__GNUC__) && __GNUC__ >= 14
168+
[[gnu::no_dangling]]
169+
#endif
170+
symbolt &
171+
fresh_java_symbol(
168172
const typet &type,
169173
const std::string &basename_prefix,
170174
const source_locationt &source_location,

jbmc/src/java_bytecode/lambda_synthesis.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,11 @@ void create_invokedynamic_synthetic_classes(
444444
}
445445
}
446446

447-
static const symbolt &get_or_create_method_symbol(
447+
#if defined(__GNUC__) && __GNUC__ >= 14
448+
[[gnu::no_dangling]]
449+
#endif
450+
static const symbolt &
451+
get_or_create_method_symbol(
448452
const irep_idt &identifier,
449453
const irep_idt &base_name,
450454
const irep_idt &pretty_name,

jbmc/unit/java-testing-utils/require_goto_statements.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ get_ultimate_source_symbol(
381381
/// \return The identifier of the ultimate source symbol assigned to the field,
382382
/// which will be used for future calls to
383383
/// `require_struct_component_assignment`.
384-
const irep_idt &require_goto_statements::require_struct_component_assignment(
384+
irep_idt require_goto_statements::require_struct_component_assignment(
385385
const irep_idt &structure_name,
386386
const std::optional<irep_idt> &superclass_name,
387387
const irep_idt &component_name,
@@ -514,8 +514,7 @@ require_goto_statements::require_struct_array_component_assignment(
514514
/// \param argument_name: Name of the input argument of method under test
515515
/// \param entry_point_statements: The statements to look through
516516
/// \return The identifier of the variable assigned to the input argument
517-
const irep_idt &
518-
require_goto_statements::require_entry_point_argument_assignment(
517+
irep_idt require_goto_statements::require_entry_point_argument_assignment(
519518
const irep_idt &argument_name,
520519
const std::vector<codet> &entry_point_statements)
521520
{

jbmc/unit/java-testing-utils/require_goto_statements.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ const code_declt &require_declaration_of_name(
7272
const irep_idt &variable_name,
7373
const std::vector<codet> &entry_point_instructions);
7474

75-
const irep_idt &require_struct_component_assignment(
75+
irep_idt require_struct_component_assignment(
7676
const irep_idt &structure_name,
7777
const std::optional<irep_idt> &superclass_name,
7878
const irep_idt &component_name,
@@ -89,7 +89,7 @@ const irep_idt &require_struct_array_component_assignment(
8989
const std::vector<codet> &entry_point_instructions,
9090
const symbol_table_baset &symbol_table);
9191

92-
const irep_idt &require_entry_point_argument_assignment(
92+
irep_idt require_entry_point_argument_assignment(
9393
const irep_idt &argument_name,
9494
const std::vector<codet> &entry_point_statements);
9595

jbmc/unit/java-testing-utils/require_type.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ namespace require_type
2424
pointer_typet
2525
require_pointer(const typet &type, const std::optional<typet> &subtype);
2626

27+
#if defined(__GNUC__) && __GNUC__ >= 14
28+
[[gnu::no_dangling]]
29+
#endif
2730
const struct_tag_typet &
2831
require_struct_tag(const typet &type, const irep_idt &identifier = "");
2932

File renamed without changes.

scripts/cadical_CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ add_library(cadical ${sources})
99

1010
# Pass -DNBUILD to disable including the version information, which is not
1111
# needed since cbmc doesn't run the cadical binary
12-
target_compile_options(cadical PUBLIC -DNBUILD)
12+
target_compile_options(cadical PUBLIC -DNBUILD -DNFLEXIBLE)
1313

1414
set_target_properties(
1515
cadical

src/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,14 +186,14 @@ glucose-download:
186186
@(cd ../glucose-syrup; patch -p1 < ../scripts/glucose-syrup-patch)
187187
@$(RM) $(glucose_rev).tar.gz
188188

189-
cadical_release = rel-1.7.2
189+
cadical_release = rel-2.0.0
190190
cadical-download:
191191
@echo "Downloading CaDiCaL $(cadical_release)"
192192
@$(DOWNLOADER) https://github.com/arminbiere/cadical/archive/$(cadical_release).tar.gz
193193
@$(TAR) xfz $(cadical_release).tar.gz
194194
@rm -Rf ../cadical
195195
@mv cadical-$(cadical_release) ../cadical
196-
@(cd ../cadical; patch -p1 < ../scripts/cadical-1.7.2-patch)
196+
@(cd ../cadical; patch -p1 < ../scripts/cadical-2.0.0-patch)
197197
@(cd ../cadical && ./configure CXX="$(CXX)")
198198
# Need to rename VERSION so that it isn't picked up by `#include<version>` on
199199
# macOS which is case insensitive

0 commit comments

Comments
 (0)