Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-Wnull dereference warning, when using -Os, -DNDEBUG and -Wnull-dereference flags after upgrading to protobuf 27.4 #19291

Open
dekiertanna opened this issue Nov 18, 2024 · 2 comments

Comments

@dekiertanna
Copy link

What version of protobuf and what language are you using?
Version: protobuflib: 5.27.4; protoc 27.4 (protobuf lite)
Language: C++

What operating system (Linux, Windows, ...) and version?
Linux, Red Hat Enterprise Linux Server 7.9 (Maipo)

What runtime / compiler are you using (e.g., python version or gcc version)
GNU 12.2.0

What did you do?
Steps to reproduce the behavior:
Minimal reproduction included in attached files.

protobuf_lite_minimal_reproduction.zip

Generally, passing an rvalue (temporary value):


    TestMessage message;
    message.add_ids(std::string("test"));

causes

[ 50%] Building CXX object CMakeFiles/MyExecutable.dir/main.o
In file included from /var/fpwork/dekiert/lim/workspace_protobuf/sdk/tmp/sysroots/qemux86-64/usr/include/c++/12.2.0/string:53,
from /var/fpwork/dekiert/lim/workspace_protobuf/sdk/tmp/sysroots/qemux86-64/usr/include/c++/12.2.0/bits/locale_classes.h:40,
from /var/fpwork/dekiert/lim/workspace_protobuf/sdk/tmp/sysroots/qemux86-64/usr/include/c++/12.2.0/bits/ios_base.h:41,
from /var/fpwork/dekiert/lim/workspace_protobuf/sdk/tmp/sysroots/qemux86-64/usr/include/c++/12.2.0/ios:42,
from /var/fpwork/dekiert/lim/workspace_protobuf/sdk/tmp/sysroots/qemux86-64/usr/include/c++/12.2.0/ostream:38,
from /var/fpwork/dekiert/lim/workspace_protobuf/sdk/tmp/sysroots/qemux86-64/usr/include/c++/12.2.0/iostream:39,
from /var/fpwork/dekiert/protobuf_reproduction/main.cpp:1:
In member function ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::pointer std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_M_data() const [with _CharT = char; _Traits = std::char_traits; _Alloc = std::allocator]’,
inlined from ‘bool std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_M_is_local() const [with _CharT = char; _Traits = std::char_traits; _Alloc = std::allocator]’ at /var/fpwork/dekiert/lim/workspace_protobuf/sdk/tmp/sysroots/qemux86-64/usr/include/c++/12.2.0/bits/basic_string.h:274:23,
inlined from ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&) [with _CharT = char; _Traits = std::char_traits; _Alloc = std::allocator]’ at /var/fpwork/dekiert/lim/workspace_protobuf/sdk/tmp/sysroots/qemux86-64/usr/include/c++/12.2.0/bits/basic_string.h:847:18,
inlined from ‘void google::protobuf::internal::RepeatedPtrFieldBase::Add(Value&&) [with TypeHandler = google::protobuf::internal::GenericTypeHandler<std::__cxx11::basic_string >; typename std::enable_if::type* = 0]’ at /var/fpwork/dekiert/lim/workspace_protobuf/sdk/tmp/sysroots/qemux86-64/usr/include/google/protobuf/repeated_ptr_field.h:197:78,
inlined from ‘void google::protobuf::RepeatedPtrField::Add(Element&&) [with Element = std::__cxx11::basic_string]’ at /var/fpwork/dekiert/lim/workspace_protobuf/sdk/tmp/sysroots/qemux86-64/usr/include/google/protobuf/repeated_ptr_field.h:1340:41,
inlined from ‘void TestMessage::add_ids(std::string&&)’ at /var/fpwork/dekiert/protobuf_reproduction/build/generated/test.pb.h:308:31,
inlined from ‘int main()’ at /var/fpwork/dekiert/protobuf_reproduction/main.cpp:7:20:
/var/fpwork/dekiert/lim/workspace_protobuf/sdk/tmp/sysroots/qemux86-64/usr/include/c++/12.2.0/bits/basic_string.h:234:28: error: null pointer dereference [-Werror=null-dereference]
234 | { return _M_dataplus._M_p; }

What did you expect to see
Compiled code

What did you see instead?
Suspicious -Wnull-dereference error

Anything else we should know about your project / environment
This issue was not happening on 24.4 version, started occurring after upgrading to protobuf 27.4

@dekiertanna dekiertanna added the untriaged auto added to all issues by default when created. label Nov 18, 2024
@acozzette
Copy link
Member

Thank you for the bug report. I find that if I build with that error enabled on gcc I see quite a few errors:

CC=/usr/bin/gcc CXX=/usr/bin/g++ bazel build -k //src/... -c opt --copt=-Werror=null-dereference --copt=-Wno-deprecated-declarations

However, I don't think these are necessarily real bugs. These look like false positives to me. I don't think we can prioritize working on actively making these errors go away, but we would be happy to review pull requests if you can figure out a way to do it.

@acozzette acozzette added c++ and removed untriaged auto added to all issues by default when created. labels Nov 19, 2024
@RAPTOR1OUS
Copy link

I think it is talking about the Width. The Hz are the two sides of the height. In example: 144 Hz is the Height + 0 (1/2+0 ) = V2=X10 (X=0) leading to 010. It the pointer where infinitesimal calculation of 1 and 0 with a certain point of chance. To add + 0 is all the refresh rate needs, since to add 0 is certain to the point where the rate will not be. and thus one remains. (1440 P) √2 whose value is 1.414

On another note (0,0) are coordinates to be used when creating a window. If not properly addressed the window does not have any position.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants