I just caught this in a regression test of my own. I boiled it down to a minimal test that can be reproduced following these steps: 1. install gentoo/releases/amd64/autobuilds/current-stage3-amd64-uclibc-vanilla/ You can either run in a real system, or just chroot in 2. emerge protobuf 3. generate the protobuf code with the following command (I'll attach the minimal .proto file needed for this). protoc test.proto --cpp_out=./ 4. compile the resulting code with the following g++ -O3 test.pb.cc -c -Wall It should spew out the following warnin, which is did not do as early as a few months ago (either gcc 9 or uclibc-ng 1.0.30+). Other libc's don't see this behaviour for me. I can reproduce it on armv6j-unknown-linux-uclibceabihf- as well. In member function 'void mymsg::SharedCtor()', inlined from 'mymsg::mymsg()' at test.pb.cc:96:13, inlined from 'void InitDefaultsscc_info_mymsg_test_2eproto()' at test.pb.cc:94:1: test.pb.cc:111:11: warning: 'void* memset(void*, int, size_t)' offset [29, 32] from the object at '_mymsg_default_instance_' is out of the bounds of referenced subobject 'mymsg::a_' with type 'unsigned int' at offset 24 [-Warray-bounds] 111 | ::memset(&a_, 0, static_cast<size_t>( | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 112 | reinterpret_cast<char*>(&b_) - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 113 | reinterpret_cast<char*>(&a_)) + sizeof(b_)); Reproducible: Always
Created attachment 632026 [details] protobuf file for minimal regression test
It should spew out the following warning, which it did not.... Sorry, just learning to type.
Actually this appears to also affect non uclibc-ng, it just was the first environment I hit it with. Looks like it's a new warning picked up by gcc9. Here's a github bug for protobuf. https://github.com/protocolbuffers/protobuf/issues/7140 Should I close this, or wait until upstream maybe addresses it? Either way I don't think it's embedded/blueness problem.
Reassigning to the maintainers of protobuf
Fixed in ProtoBuf >=3.14.0: https://github.com/protocolbuffers/protobuf/issues/7140 https://github.com/protocolbuffers/protobuf/pull/7913 https://github.com/protocolbuffers/protobuf/commit/d16bf914bc5ba569d2b70376051d15f68ce4322d