diff --git a/flatbuffers.spec b/flatbuffers.spec index 97d587f24c62a839f7ef6781e388b8fbdb7429d2..40722af1d11e630a94e8ba8bc8aabb1cbcb6811e 100644 --- a/flatbuffers.spec +++ b/flatbuffers.spec @@ -5,7 +5,7 @@ %endif Name: flatbuffers Version: 2.0.0 -Release: 5 +Release: 6 Summary: Memory efficient serialization library License: Apache-2.0 URL: https://github.com/google/flatbuffers @@ -18,6 +18,7 @@ Patch1: 0002-typo-fixes-in-comments.patch Patch2: 0003-Changes-to-support-binary-schema-file-loading-and-pa.patch Patch3: 0004-output-errors-instead-of-stdout.patch Patch4: 0005-fix-undefined-behaviour.patch +Patch5: test-fix-undefined-order-of-functio-parameters.-6946.patch BuildRequires: gcc-c++ cmake >= 2.8.9 Provides: bundled(grpc) @@ -94,6 +95,9 @@ make test %{python3_sitelib}/ %changelog +* Thu Jul 20 2023 chenchen - 2.0.0-6 +- fix build error due to gcc upgrade to 12 + * Tue Nov 22 2022 Bin Hu - 2.0.0-5 - add python subpackage for tensorflow 2.10 build diff --git a/test-fix-undefined-order-of-functio-parameters.-6946.patch b/test-fix-undefined-order-of-functio-parameters.-6946.patch new file mode 100644 index 0000000000000000000000000000000000000000..82a61cd5ab5ed2023ff9d41d834bd60aeb87c8ed --- /dev/null +++ b/test-fix-undefined-order-of-functio-parameters.-6946.patch @@ -0,0 +1,62 @@ +From 85b4effac69202fb360db16ffd0354ef76baa321 Mon Sep 17 00:00:00 2001 +From: Sergei Trofimovich +Date: Mon, 22 Nov 2021 20:14:31 +0000 +Subject: [PATCH] test: fix undefined order of functio parameters. (#6946) + +Detected instability when built `flatbuffers-2.0.0` on `gcc-12`: + + [ 75%] Building CXX object CMakeFiles/flattests.dir/tests/test_builder.cpp.o + .../c++/12.0.0/bits/shared_ptr_base.h:397:45: error: 'size' may be used uninitialized [-Werror=maybe-uninitialized] + 397 | explicit _Sp_ebo_helper(_Tp&& __tp) : _M_tp(std::move(__tp)) { } + | ^~~~~~~~~~~~~~~~~~~~~~ + In file included from flatbuffers/tests/test_builder.cpp:1: + flatbuffers/tests/test_builder.h: In function 'void builder_move_assign_after_releaseraw_test(Builder) [with Builder = flatbuffers::FlatBufferBuilder]': + flatbuffers/tests/test_builder.h:63:10: note: 'size' was declared here + 63 | size_t size, offset; + | ^~~~ + ... + In file included from flatbuffers/tests/test_builder.cpp:1: + flatbuffers/tests/test_builder.h: In function 'void builder_move_assign_after_releaseraw_test(Builder) [with Builder = GrpcLikeMessageBuilder]': + flatbuffers/tests/test_builder.h:63:10: note: 'size' was declared here + 63 | size_t size, offset; + | ^~~~ + cc1plus: all warnings being treated as errors + +Here is the relevant bit of test: + + template + void builder_move_assign_after_releaseraw_test(Builder b1) { + auto root_offset1 = populate1(b1); + b1.Finish(root_offset1); + size_t size, offset; + std::shared_ptr raw( + b1.ReleaseRaw(size, offset), [size](uint8_t *ptr) { + flatbuffers::DefaultAllocator::dealloc(ptr, size); + }); + +Note how `b1.ReleaseRaw(size, offset)` is expected to populate `size` +and `[size](uint8_t *ptr) {` captures the result. But both are parameters +to the same function call and thus evaluation order is unspecified. +--- + tests/test_builder.h | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/tests/test_builder.h b/tests/test_builder.h +index 6d97ac00..75338b04 100644 +--- a/tests/test_builder.h ++++ b/tests/test_builder.h +@@ -61,8 +61,10 @@ void builder_move_assign_after_releaseraw_test(Builder b1) { + auto root_offset1 = populate1(b1); + b1.Finish(root_offset1); + size_t size, offset; ++ ++ uint8_t *rr = b1.ReleaseRaw(size, offset); + std::shared_ptr raw( +- b1.ReleaseRaw(size, offset), [size](uint8_t *ptr) { ++ rr, [size](uint8_t *ptr) { + flatbuffers::DefaultAllocator::dealloc(ptr, size); + }); + Builder src; +-- +2.39.1 +