diff --git a/easybuild/easyconfigs/b/Bazel/Bazel-3.7.1_fix-protobuf-env.patch b/easybuild/easyconfigs/b/Bazel/Bazel-3.7.1_fix-protobuf-env.patch new file mode 100644 index 00000000000..0e110a6723d --- /dev/null +++ b/easybuild/easyconfigs/b/Bazel/Bazel-3.7.1_fix-protobuf-env.patch @@ -0,0 +1,20 @@ +diff --git a/third_party/protobuf/3.13.0.patch b/third_party/protobuf/3.13.0.patch +index bde8684b82..3336ef4024 100644 +--- a/third_party/protobuf/3.13.0.patch ++++ b/third_party/protobuf/3.13.0.patch +@@ -38,3 +38,15 @@ index cfdb28e2e..3705fdbe3 100644 + + "@io_bazel//third_party:gson", + ], + ) ++diff --git a/protobuf.bzl b/protobuf.bzl ++index 050eafc54..12d3edb94 100644 ++--- a/protobuf.bzl +++++ b/protobuf.bzl ++@@ -352,6 +352,7 @@ def _internal_gen_well_known_protos_java_impl(ctx): ++ inputs = descriptors, ++ outputs = [srcjar], ++ arguments = [args], +++ use_default_shell_env = True, ++ ) ++ ++ return [ diff --git a/easybuild/easyconfigs/b/Bazel/Bazel-3.7.2-GCCcore-10.2.0.eb b/easybuild/easyconfigs/b/Bazel/Bazel-3.7.2-GCCcore-10.2.0.eb new file mode 100644 index 00000000000..6b259a49b41 --- /dev/null +++ b/easybuild/easyconfigs/b/Bazel/Bazel-3.7.2-GCCcore-10.2.0.eb @@ -0,0 +1,38 @@ +name = 'Bazel' +version = '3.7.2' + +homepage = 'https://bazel.io/' +description = """Bazel is a build tool that builds code quickly and reliably. +It is used to build the majority of Google's software.""" + +toolchain = {'name': 'GCCcore', 'version': '10.2.0'} + +source_urls = ['https://github.com/bazelbuild/bazel/releases/download/%(version)s'] +sources = ['%(namelower)s-%(version)s-dist.zip'] +patches = [ + '%(name)s-3.4.1-fix-grpc-protoc.patch', + 'Bazel-3.7.1_fix-protobuf-env.patch', +] +checksums = [ + 'de255bb42163a915312df9f4b86e5b874b46d9e8d4b72604b5123c3a845ed9b1', # bazel-3.7.2-dist.zip + 'f87ad8ad6922fd9c974381ea22b7b0e6502ccad5e532145f179b80d5599e24ac', # Bazel-3.4.1-fix-grpc-protoc.patch + '8706ecc99b658e0a96c38dc2c23e44da35059b85f308602aac76a6d6680376e7', # Bazel-3.7.1_fix-protobuf-env.patch +] + +builddependencies = [ + ('binutils', '2.35'), + ('Python', '3.8.6'), + ('Zip', '3.0'), +] +dependencies = [('Java', '11', '', True)] + +runtest = True +testopts = ' '.join([ + '--', + '//examples/cpp:hello-success_test', + '//examples/py/...', + '//examples/py_native:test', + '//examples/shell/...', +]) + +moduleclass = 'devel' diff --git a/easybuild/easyconfigs/f/flatbuffers-python/flatbuffers-python-1.12-GCCcore-10.2.0.eb b/easybuild/easyconfigs/f/flatbuffers-python/flatbuffers-python-1.12-GCCcore-10.2.0.eb new file mode 100644 index 00000000000..7d9f73d5598 --- /dev/null +++ b/easybuild/easyconfigs/f/flatbuffers-python/flatbuffers-python-1.12-GCCcore-10.2.0.eb @@ -0,0 +1,27 @@ +easyblock = 'PythonPackage' + +name = 'flatbuffers-python' +version = '1.12' + +homepage = 'https://github.com/google/flatbuffers/' +description = """Python Flatbuffers runtime library.""" + +toolchain = {'name': 'GCCcore', 'version': '10.2.0'} + +source_urls = ['https://pypi.python.org/packages/source/f/flatbuffers'] +sources = [{'download_filename': 'flatbuffers-%(version)s.tar.gz', 'filename': SOURCE_TAR_GZ}] +checksums = ['63bb9a722d5e373701913e226135b28a6f6ac200d5cc7b4d919fa38d73b44610'] + +dependencies = [ + ('binutils', '2.35'), + ('Python', '3.8.6'), +] + +download_dep_fail = True +use_pip = True +sanity_pip_check = True + +preinstallopts = 'VERSION=%(version)s ' +options = {'modulename': 'flatbuffers'} + +moduleclass = 'devel' diff --git a/easybuild/easyconfigs/f/flatbuffers/flatbuffers-1.12.0-GCCcore-10.2.0.eb b/easybuild/easyconfigs/f/flatbuffers/flatbuffers-1.12.0-GCCcore-10.2.0.eb new file mode 100644 index 00000000000..8f9764b10b4 --- /dev/null +++ b/easybuild/easyconfigs/f/flatbuffers/flatbuffers-1.12.0-GCCcore-10.2.0.eb @@ -0,0 +1,40 @@ +easyblock = 'CMakeNinja' + +name = 'flatbuffers' +version = '1.12.0' + +homepage = 'https://github.com/google/flatbuffers/' +description = """FlatBuffers: Memory Efficient Serialization Library""" + +toolchain = {'name': 'GCCcore', 'version': '10.2.0'} +toolchainopts = {'pic': True} + +source_urls = ['https://github.com/google/flatbuffers/archive/v%(version)s/'] +sources = [SOURCE_TAR_GZ] +patches = [ + 'flatbuffers-1.12.0_replace-usage-of-memset.patch', + 'flatbuffers-1.12.0_silence-str-op-false-positive.patch', +] +checksums = [ + '62f2223fb9181d1d6338451375628975775f7522185266cd5296571ac152bc45', + # flatbuffers-1.12.0_replace-usage-of-memset.patch + '094a98b5a7debbc2c60c2b235942c79e505ec76f9281f87c95d15e9ad8a97c52', + # flatbuffers-1.12.0_silence-str-op-false-positive.patch + '4a9a18abc776407f3f97e02c40f349cfb24fe7ddb41df952271d894777a31c88', +] + +builddependencies = [ + ('binutils', '2.35'), + ('CMake', '3.18.4'), + ('Ninja', '1.10.1'), + ('Python', '3.8.6'), +] + +configopts = '-DFLATBUFFERS_ENABLE_PCH=ON ' + +sanity_check_paths = { + 'files': ['include/flatbuffers/flatbuffers.h', 'bin/flatc', 'lib/libflatbuffers.a'], + 'dirs': ['lib/cmake'], +} + +moduleclass = 'devel' diff --git a/easybuild/easyconfigs/f/flatbuffers/flatbuffers-1.12.0_replace-usage-of-memset.patch b/easybuild/easyconfigs/f/flatbuffers/flatbuffers-1.12.0_replace-usage-of-memset.patch new file mode 100644 index 00000000000..83742d5b0fb --- /dev/null +++ b/easybuild/easyconfigs/f/flatbuffers/flatbuffers-1.12.0_replace-usage-of-memset.patch @@ -0,0 +1,471 @@ +Avoids warnings on GCC 10 +Taken from https://github.com/google/flatbuffers/pull/5938 + +Author: bakinovsky-m + + +diff --git a/include/flatbuffers/base.h b/include/flatbuffers/base.h +index 95573806..3d7aeb4a 100644 +--- a/include/flatbuffers/base.h ++++ b/include/flatbuffers/base.h +@@ -309,6 +309,7 @@ typedef uintmax_t largest_scalar_t; + #define FLATBUFFERS_MAX_ALIGNMENT 16 + + #if defined(_MSC_VER) ++ #pragma warning(disable: 4351) // C4351: new behavior: elements of array ... will be default initialized + #pragma warning(push) + #pragma warning(disable: 4127) // C4127: conditional expression is constant + #endif +diff --git a/samples/monster_generated.h b/samples/monster_generated.h +index 4e49d5f9..88d7272e 100644 +--- a/samples/monster_generated.h ++++ b/samples/monster_generated.h +@@ -179,8 +179,10 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) Vec3 FLATBUFFERS_FINAL_CLASS { + static const flatbuffers::TypeTable *MiniReflectTypeTable() { + return Vec3TypeTable(); + } +- Vec3() { +- memset(static_cast(this), 0, sizeof(Vec3)); ++ Vec3() ++ : x_(0), ++ y_(0), ++ z_(0) { + } + Vec3(float _x, float _y, float _z) + : x_(flatbuffers::EndianScalar(_x)), +diff --git a/src/idl_gen_cpp.cpp b/src/idl_gen_cpp.cpp +index f78ee268..5dd3277c 100644 +--- a/src/idl_gen_cpp.cpp ++++ b/src/idl_gen_cpp.cpp +@@ -2854,7 +2854,117 @@ class CppGenerator : public BaseGenerator { + + static void PaddingNoop(int bits, std::string *code_ptr, int *id) { + (void)bits; +- *code_ptr += " (void)padding" + NumToString((*id)++) + "__;"; ++ *code_ptr += " (void)padding" + NumToString((*id)++) + "__;\n"; ++ } ++ ++ void GenStructDefaultConstructor(const StructDef &struct_def) { ++ std::string init_list; ++ std::string body; ++ bool first_in_init_list = true; ++ int padding_initializer_id = 0; ++ int padding_body_id = 0; ++ for (auto it = struct_def.fields.vec.begin(); ++ it != struct_def.fields.vec.end(); ++ ++it) { ++ const auto field = *it; ++ const auto field_name = field->name + "_"; ++ ++ if (first_in_init_list) { ++ first_in_init_list = false; ++ } else { ++ init_list += ","; ++ init_list += "\n "; ++ } ++ ++ init_list += field_name; ++ if (IsStruct(field->value.type) || IsArray(field->value.type)) { ++ // this is either default initialization of struct ++ // or ++ // implicit initialization of array ++ // for each object in array it: ++ // * sets it as zeros for POD types (integral, floating point, etc) ++ // * calls default constructor for classes/structs ++ init_list += "()"; ++ } else { ++ init_list += "(0)"; ++ } ++ if (field->padding) { ++ GenPadding(*field, &init_list, &padding_initializer_id, ++ PaddingInitializer); ++ GenPadding(*field, &body, &padding_body_id, PaddingNoop); ++ } ++ } ++ ++ if (init_list.empty()) { ++ code_ += " {{STRUCT_NAME}}()"; ++ code_ += " {}"; ++ } else { ++ code_.SetValue("INIT_LIST", init_list); ++ code_.SetValue("DEFAULT_CONSTRUCTOR_BODY", body); ++ code_ += " {{STRUCT_NAME}}()"; ++ code_ += " : {{INIT_LIST}} {"; ++ code_ += "{{DEFAULT_CONSTRUCTOR_BODY}} }"; ++ } ++ } ++ ++ void GenStructConstructor(const StructDef &struct_def) { ++ std::string arg_list; ++ std::string init_list; ++ int padding_id = 0; ++ bool first_arg = true; ++ bool first_init = true; ++ for (auto it = struct_def.fields.vec.begin(); ++ it != struct_def.fields.vec.end(); ++it) { ++ const auto &field = **it; ++ const auto &field_type = field.value.type; ++ const auto member_name = Name(field) + "_"; ++ const auto arg_name = "_" + Name(field); ++ const auto arg_type = GenTypeGet(field_type, " ", "const ", " &", true); ++ ++ if (!IsArray(field_type)) { ++ if (first_arg) { ++ first_arg = false; ++ } else { ++ arg_list += ", "; ++ } ++ arg_list += arg_type; ++ arg_list += arg_name; ++ } ++ if (first_init) { ++ first_init = false; ++ } else { ++ init_list += ","; ++ init_list += "\n "; ++ } ++ init_list += member_name; ++ if (IsScalar(field_type.base_type)) { ++ auto type = GenUnderlyingCast(field, false, arg_name); ++ init_list += "(flatbuffers::EndianScalar(" + type + "))"; ++ } else if (IsArray(field_type)) { ++ // implicit initialization of array ++ // for each object in array it: ++ // * sets it as zeros for POD types (integral, floating point, etc) ++ // * calls default constructor for classes/structs ++ init_list += "()"; ++ } else { ++ init_list += "(" + arg_name + ")"; ++ } ++ if (field.padding) { ++ GenPadding(field, &init_list, &padding_id, PaddingInitializer); ++ } ++ } ++ ++ if (!arg_list.empty()) { ++ code_.SetValue("ARG_LIST", arg_list); ++ code_.SetValue("INIT_LIST", init_list); ++ if (!init_list.empty()) { ++ code_ += " {{STRUCT_NAME}}({{ARG_LIST}})"; ++ code_ += " : {{INIT_LIST}} {"; ++ } else { ++ code_ += " {{STRUCT_NAME}}({{ARG_LIST}}) {"; ++ } ++ code_ += " }"; ++ } + } + + // Generate an accessor struct with constructor for a flatbuffers struct. +@@ -2908,10 +3018,7 @@ class CppGenerator : public BaseGenerator { + GenFullyQualifiedNameGetter(struct_def, Name(struct_def)); + + // Generate a default constructor. +- code_ += " {{STRUCT_NAME}}() {"; +- code_ += +- " memset(static_cast(this), 0, sizeof({{STRUCT_NAME}}));"; +- code_ += " }"; ++ GenStructDefaultConstructor(struct_def); + + // Generate a constructor that takes all fields as arguments, + // excluding arrays +diff --git a/tests/arrays_test_generated.h b/tests/arrays_test_generated.h +index 30e78846..f5dc23ec 100644 +--- a/tests/arrays_test_generated.h ++++ b/tests/arrays_test_generated.h +@@ -75,15 +75,23 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(8) NestedStruct FLATBUFFERS_FINAL_CLASS { + static const flatbuffers::TypeTable *MiniReflectTypeTable() { + return NestedStructTypeTable(); + } +- NestedStruct() { +- memset(static_cast(this), 0, sizeof(NestedStruct)); ++ NestedStruct() ++ : a_(), ++ b_(0), ++ c_(), ++ padding0__(0), ++ padding1__(0), ++ d_() { ++ (void)padding0__; ++ (void)padding1__; + } + NestedStruct(MyGame::Example::TestEnum _b) +- : b_(flatbuffers::EndianScalar(static_cast(_b))) { +- std::memset(a_, 0, sizeof(a_)); +- std::memset(c_, 0, sizeof(c_)); +- (void)padding0__; (void)padding1__; +- std::memset(d_, 0, sizeof(d_)); ++ : a_(), ++ b_(flatbuffers::EndianScalar(static_cast(_b))), ++ c_(), ++ padding0__(0), ++ padding1__(0), ++ d_() { + } + const flatbuffers::Array *a() const { + return reinterpret_cast *>(a_); +@@ -140,22 +148,33 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(8) ArrayStruct FLATBUFFERS_FINAL_CLASS { + static const flatbuffers::TypeTable *MiniReflectTypeTable() { + return ArrayStructTypeTable(); + } +- ArrayStruct() { +- memset(static_cast(this), 0, sizeof(ArrayStruct)); ++ ArrayStruct() ++ : a_(0), ++ b_(), ++ c_(0), ++ padding0__(0), ++ padding1__(0), ++ padding2__(0), ++ d_(), ++ e_(0), ++ padding3__(0), ++ f_() { ++ (void)padding0__; ++ (void)padding1__; ++ (void)padding2__; ++ (void)padding3__; + } + ArrayStruct(float _a, int8_t _c, int32_t _e) + : a_(flatbuffers::EndianScalar(_a)), ++ b_(), + c_(flatbuffers::EndianScalar(_c)), + padding0__(0), + padding1__(0), + padding2__(0), ++ d_(), + e_(flatbuffers::EndianScalar(_e)), +- padding3__(0) { +- std::memset(b_, 0, sizeof(b_)); +- (void)padding0__; (void)padding1__; (void)padding2__; +- std::memset(d_, 0, sizeof(d_)); +- (void)padding3__; +- std::memset(f_, 0, sizeof(f_)); ++ padding3__(0), ++ f_() { + } + float a() const { + return flatbuffers::EndianScalar(a_); +diff --git a/tests/cpp17/generated_cpp17/monster_test_generated.h b/tests/cpp17/generated_cpp17/monster_test_generated.h +index 359fd1a9..72ed6de8 100644 +--- a/tests/cpp17/generated_cpp17/monster_test_generated.h ++++ b/tests/cpp17/generated_cpp17/monster_test_generated.h +@@ -477,14 +477,16 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(2) Test FLATBUFFERS_FINAL_CLASS { + static const flatbuffers::TypeTable *MiniReflectTypeTable() { + return TestTypeTable(); + } +- Test() { +- memset(static_cast(this), 0, sizeof(Test)); ++ Test() ++ : a_(0), ++ b_(0), ++ padding0__(0) { ++ (void)padding0__; + } + Test(int16_t _a, int8_t _b) + : a_(flatbuffers::EndianScalar(_a)), + b_(flatbuffers::EndianScalar(_b)), + padding0__(0) { +- (void)padding0__; + } + int16_t a() const { + return flatbuffers::EndianScalar(a_); +@@ -517,8 +519,19 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(8) Vec3 FLATBUFFERS_FINAL_CLASS { + static const flatbuffers::TypeTable *MiniReflectTypeTable() { + return Vec3TypeTable(); + } +- Vec3() { +- memset(static_cast(this), 0, sizeof(Vec3)); ++ Vec3() ++ : x_(0), ++ y_(0), ++ z_(0), ++ padding0__(0), ++ test1_(0), ++ test2_(0), ++ padding1__(0), ++ test3_(), ++ padding2__(0) { ++ (void)padding0__; ++ (void)padding1__; ++ (void)padding2__; + } + Vec3(float _x, float _y, float _z, double _test1, MyGame::Example::Color _test2, const MyGame::Example::Test &_test3) + : x_(flatbuffers::EndianScalar(_x)), +@@ -530,9 +543,6 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(8) Vec3 FLATBUFFERS_FINAL_CLASS { + padding1__(0), + test3_(_test3), + padding2__(0) { +- (void)padding0__; +- (void)padding1__; +- (void)padding2__; + } + float x() const { + return flatbuffers::EndianScalar(x_); +@@ -582,8 +592,9 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) Ability FLATBUFFERS_FINAL_CLASS { + static const flatbuffers::TypeTable *MiniReflectTypeTable() { + return AbilityTypeTable(); + } +- Ability() { +- memset(static_cast(this), 0, sizeof(Ability)); ++ Ability() ++ : id_(0), ++ distance_(0) { + } + Ability(uint32_t _id, uint32_t _distance) + : id_(flatbuffers::EndianScalar(_id)), +diff --git a/tests/monster_test_generated.h b/tests/monster_test_generated.h +index ad87ffe3..7f555577 100644 +--- a/tests/monster_test_generated.h ++++ b/tests/monster_test_generated.h +@@ -592,14 +592,16 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(2) Test FLATBUFFERS_FINAL_CLASS { + static const flatbuffers::TypeTable *MiniReflectTypeTable() { + return TestTypeTable(); + } +- Test() { +- memset(static_cast(this), 0, sizeof(Test)); ++ Test() ++ : a_(0), ++ b_(0), ++ padding0__(0) { ++ (void)padding0__; + } + Test(int16_t _a, int8_t _b) + : a_(flatbuffers::EndianScalar(_a)), + b_(flatbuffers::EndianScalar(_b)), + padding0__(0) { +- (void)padding0__; + } + int16_t a() const { + return flatbuffers::EndianScalar(a_); +@@ -643,8 +645,19 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(8) Vec3 FLATBUFFERS_FINAL_CLASS { + static const flatbuffers::TypeTable *MiniReflectTypeTable() { + return Vec3TypeTable(); + } +- Vec3() { +- memset(static_cast(this), 0, sizeof(Vec3)); ++ Vec3() ++ : x_(0), ++ y_(0), ++ z_(0), ++ padding0__(0), ++ test1_(0), ++ test2_(0), ++ padding1__(0), ++ test3_(), ++ padding2__(0) { ++ (void)padding0__; ++ (void)padding1__; ++ (void)padding2__; + } + Vec3(float _x, float _y, float _z, double _test1, MyGame::Example::Color _test2, const MyGame::Example::Test &_test3) + : x_(flatbuffers::EndianScalar(_x)), +@@ -656,9 +669,6 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(8) Vec3 FLATBUFFERS_FINAL_CLASS { + padding1__(0), + test3_(_test3), + padding2__(0) { +- (void)padding0__; +- (void)padding1__; +- (void)padding2__; + } + float x() const { + return flatbuffers::EndianScalar(x_); +@@ -723,8 +733,9 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) Ability FLATBUFFERS_FINAL_CLASS { + static const flatbuffers::TypeTable *MiniReflectTypeTable() { + return AbilityTypeTable(); + } +- Ability() { +- memset(static_cast(this), 0, sizeof(Ability)); ++ Ability() ++ : id_(0), ++ distance_(0) { + } + Ability(uint32_t _id, uint32_t _distance) + : id_(flatbuffers::EndianScalar(_id)), +diff --git a/tests/namespace_test/namespace_test1_generated.h b/tests/namespace_test/namespace_test1_generated.h +index feae671a..c0c5be16 100644 +--- a/tests/namespace_test/namespace_test1_generated.h ++++ b/tests/namespace_test/namespace_test1_generated.h +@@ -66,8 +66,9 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) StructInNestedNS FLATBUFFERS_FINAL_CLASS + static const flatbuffers::TypeTable *MiniReflectTypeTable() { + return StructInNestedNSTypeTable(); + } +- StructInNestedNS() { +- memset(static_cast(this), 0, sizeof(StructInNestedNS)); ++ StructInNestedNS() ++ : a_(0), ++ b_(0) { + } + StructInNestedNS(int32_t _a, int32_t _b) + : a_(flatbuffers::EndianScalar(_a)), +diff --git a/tests/native_type_test_generated.h b/tests/native_type_test_generated.h +index 91114264..94dbcaaa 100644 +--- a/tests/native_type_test_generated.h ++++ b/tests/native_type_test_generated.h +@@ -30,8 +30,10 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) Vector3D FLATBUFFERS_FINAL_CLASS { + static const flatbuffers::TypeTable *MiniReflectTypeTable() { + return Vector3DTypeTable(); + } +- Vector3D() { +- memset(static_cast(this), 0, sizeof(Vector3D)); ++ Vector3D() ++ : x_(0), ++ y_(0), ++ z_(0) { + } + Vector3D(float _x, float _y, float _z) + : x_(flatbuffers::EndianScalar(_x)), +diff --git a/tests/test.cpp b/tests/test.cpp +index 13bd66d5..69a029cf 100644 +--- a/tests/test.cpp ++++ b/tests/test.cpp +@@ -3205,6 +3205,24 @@ void FixedLengthArrayTest() { + // Check alignment + TEST_EQ(0, reinterpret_cast(mArStruct->d()) % 8); + TEST_EQ(0, reinterpret_cast(mArStruct->f()) % 8); ++ ++ // Check if default constructor set all memory zero ++ const size_t arr_size = sizeof(MyGame::Example::ArrayStruct); ++ char non_zero_memory[arr_size]; ++ // set memory chunk of size ArrayStruct to 1's ++ std::memset(static_cast(non_zero_memory), 1, arr_size); ++ // after placement-new it should be all 0's ++#if defined (_MSC_VER) && defined (_DEBUG) ++ #undef new ++#endif ++ MyGame::Example::ArrayStruct *ap = new (non_zero_memory) MyGame::Example::ArrayStruct; ++#if defined (_MSC_VER) && defined (_DEBUG) ++ #define new DEBUG_NEW ++#endif ++ (void)ap; ++ for (size_t i = 0; i < arr_size; ++i) { ++ TEST_EQ(non_zero_memory[i], 0); ++ } + #endif + } + +diff --git a/tests/union_vector/union_vector_generated.h b/tests/union_vector/union_vector_generated.h +index a03f7227..59477213 100644 +--- a/tests/union_vector/union_vector_generated.h ++++ b/tests/union_vector/union_vector_generated.h +@@ -202,8 +202,8 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) Rapunzel FLATBUFFERS_FINAL_CLASS { + static const flatbuffers::TypeTable *MiniReflectTypeTable() { + return RapunzelTypeTable(); + } +- Rapunzel() { +- memset(static_cast(this), 0, sizeof(Rapunzel)); ++ Rapunzel() ++ : hair_length_(0) { + } + Rapunzel(int32_t _hair_length) + : hair_length_(flatbuffers::EndianScalar(_hair_length)) { +@@ -235,8 +235,8 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) BookReader FLATBUFFERS_FINAL_CLASS { + static const flatbuffers::TypeTable *MiniReflectTypeTable() { + return BookReaderTypeTable(); + } +- BookReader() { +- memset(static_cast(this), 0, sizeof(BookReader)); ++ BookReader() ++ : books_read_(0) { + } + BookReader(int32_t _books_read) + : books_read_(flatbuffers::EndianScalar(_books_read)) { diff --git a/easybuild/easyconfigs/f/flatbuffers/flatbuffers-1.12.0_silence-str-op-false-positive.patch b/easybuild/easyconfigs/f/flatbuffers/flatbuffers-1.12.0_silence-str-op-false-positive.patch new file mode 100644 index 00000000000..a2aedef30d0 --- /dev/null +++ b/easybuild/easyconfigs/f/flatbuffers/flatbuffers-1.12.0_silence-str-op-false-positive.patch @@ -0,0 +1,39 @@ +From 44c7a4cf439b0a298720b5a448bcc243a882b0c9 Mon Sep 17 00:00:00 2001 +From: Vasyl Gello +Date: Tue, 23 Jun 2020 09:08:33 +0000 +Subject: [PATCH] Silence false positive "-Wstringop-overflow" on GCC 10.0 to + 11.0 + +--- + include/flatbuffers/base.h | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/include/flatbuffers/base.h b/include/flatbuffers/base.h +index bfa02666d6..d83c7756e5 100644 +--- a/include/flatbuffers/base.h ++++ b/include/flatbuffers/base.h +@@ -381,6 +381,13 @@ T ReadScalar(const void *p) { + return EndianScalar(*reinterpret_cast(p)); + } + ++// See https://github.com/google/flatbuffers/issues/5950 ++ ++#if (FLATBUFFERS_GCC >= 100000) && (FLATBUFFERS_GCC < 110000) ++ #pragma GCC diagnostic push ++ #pragma GCC diagnostic ignored "-Wstringop-overflow" ++#endif ++ + template + // UBSAN: C++ aliasing type rules, see std::bit_cast<> for details. + __supress_ubsan__("alignment") +@@ -393,6 +400,10 @@ template __supress_ubsan__("alignment") void WriteScalar(void *p, Of + *reinterpret_cast(p) = EndianScalar(t.o); + } + ++#if (FLATBUFFERS_GCC >= 100000) && (FLATBUFFERS_GCC < 110000) ++ #pragma GCC diagnostic pop ++#endif ++ + // Computes how many bytes you'd have to pad to be able to write an + // "scalar_size" scalar if the buffer had grown to "buf_size" (downwards in + // memory).