Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 716986

Summary: dev-libs/protobuf: warning: ... memset ... from the object at ... is out of the bounds of referenced subobject ... [-Warray-bounds]
Product: Gentoo Linux Reporter: David Flogeras <dflogeras2>
Component: Current packagesAssignee: Arfrever Frehtes Taifersar Arahesis <arfrever.fta>
Status: RESOLVED FIXED    
Severity: normal CC: floppym, jstein
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: All   
URL: https://github.com/protocolbuffers/protobuf/issues/7140
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: protobuf file for minimal regression test

Description David Flogeras 2020-04-10 20:43:48 UTC
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
Comment 1 David Flogeras 2020-04-10 20:44:45 UTC
Created attachment 632026 [details]
protobuf file for minimal regression test
Comment 2 David Flogeras 2020-04-10 20:46:42 UTC
It should spew out the following warning, which it did not....

Sorry, just learning to type.
Comment 3 David Flogeras 2020-06-06 12:48:08 UTC
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.
Comment 4 Anthony Basile gentoo-dev 2020-06-16 11:14:53 UTC
Reassigning to the maintainers of protobuf