Closed doko42 closed 4 years ago
The errors are somewhere inside the code generated by the Google Protobuf library. This code is only used to test or own implementation against, so I don't think there is something wrong with the Protozero library here. You might want to report this as a bug to Google Protobuf library.
I don't know what is happening with the -Wno-covered-switch-default
option. In the default config GCC doesn't complain about it, it seems only to get triggered when -O3
and -g
is set. Strange. But I don't think I can do anything about it.
the build fails when building with -O3 and some hardening flags enabled:
-g -O3 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2
Also GCC complains about an unknown option: At global scope: cc1plus: error: unrecognized command line option ‘-Wno-covered-switch-default’ [-Werror] cc1plus: all warnings being treated as errors
In file included from /usr/x86_64-linux-gnu/include/string.h:495, from /usr/include/c++/9/cstring:42, from /usr/include/google/protobuf/io/coded_stream.h:118, from /packages/tmp/protozero-1.6.8/obj-x86_64-linux-gnu/test/t/nested/nested_testcase.pb.h:23, from /packages/tmp/protozero-1.6.8/obj-x86_64-linux-gnu/test/t/nested/nested_testcase.pb.cc:4: In function ‘void memset(void, int, size_t)’, inlined from ‘void TestNested::Test::SharedCtor()’ at /packages/tmp/protozero-1.6.8/obj-x86_64-linux-gnu/test/t/nested/nest ed_testcase.pb.cc:584:11, inlined from ‘TestNested::Test::Test()’ at /packages/tmp/protozero-1.6.8/obj-x86_64-linux-gnu/test/t/nested/nested_testcase .pb.cc:565:13, inlined from ‘void InitDefaultsscc_info_Test_nested_5ftestcase_2eproto()’ at /packages/tmp/protozero-1.6.8/obj-x86_64-linux -gnu/test/t/nested/nested_testcase.pb.cc:563:1: /usr/x86_64-linux-gnu/include/bits/string_fortified.h:71:33: error: ‘void __builtin_memset(void, int, long unsigned int)’ offset [33, 36] from the object at ‘TestNested::_Test_defaultinstance’ is out of the bounds of referenced subobject ‘TestNested::Test::sub_’ with type ‘TestNested::Sub’ at offset 24 [-Werror=array-bounds] 71 | return builtin___memset_chk (dest, ch, len, bos0 (dest)); |
~~~~~^~~~~~~~In function ‘void memset(void, int, size_t)’, inlined from ‘void TestNested::Sub::SharedCtor()’ at /packages/tmp/protozero-1.6.8/obj-x86_64-linux-gnu/test/t/nested/nested_testcase.pb.cc:347:11, inlined from ‘TestNested::Sub::Sub()’ at /packages/tmp/protozero-1.6.8/obj-x86_64-linux-gnu/test/t/nested/nested_testcase.pb.cc:328:13, inlined from ‘void InitDefaultsscc_info_Sub_nested_5ftestcase_2eproto()’ at /packages/tmp/protozero-1.6.8/obj-x86_64-linux-gnu/test/t/nested/nested_testcase.pb.cc:326:1: /usr/x86_64-linux-gnu/include/bits/string_fortified.h:71:33: error: ‘void builtin_memset(void, int, long unsigned int)’ offset [33, 36] from the object at ‘TestNested::_Sub_defaultinstance’ is out of the bounds of referenced subobject ‘TestNested::Sub::subsub_’ with type ‘TestNested::SubSub’ at offset 24 [-Werror=array-bounds] 71 | return builtin_memset_chk (dest, ch, len, bos0 (dest)); |~~~~~^~~~~~~~