-
Notifications
You must be signed in to change notification settings - Fork 15.6k
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
master/ Fedora 32 / gcc10 FAIL with -Werror=type-limits in google/protobuf/map_lite_unittest.pb.cc #7514
Comments
I feel this is more a "compiler bug" then an issue in our code. gcc is issuing a warning the code actively protects itself from. |
Here is a small reproduction If code explicitely checks a case cannot occur then a warning in dead code is IMO a compiler bug in the warnings. |
Thank you for clarification! FYI: there are already bug report https://gcc.gnu.org/PR95148 |
I got this error too on Fedora 33 (Rawhide) on riscv64 while compiling 3.11.4 release.
|
Hi, @gerben-s Technically this warning can be avoided by using compile time "if": I checked on Compiler Explorer and that works (ie the warning goes away with recent gcc). Cheers, |
Note: this issue is fixed in Protobuf >= 3.15.0 thanks to PR #8092. |
@Romain-Geissler-1A i can confirm i'm still seeing this error with
|
@Romain-Geissler-1A Sorry for the confusion! Thanks for the fix! |
so this is fixed? |
protobuf
commit 2ae7cf0 (HEAD -> master, origin/master, origin/HEAD)
Fedora 32 / x86_64
gcc version 10.1.1 20200507 (Red Hat 10.1.1-1) (GCC)
git pull
./autogen.sh
./configure --prefix=/usr/local/protobuf
make -j2
V=1 make check
[...]
g++ -DHAVE_CONFIG_H -I. -I.. -pthread -DHAVE_PTHREAD=1 -DHAVE_ZLIB=1 -Wall -Wextra -Werror -Wno-unused-parameter -g -std=c++11 -DNDEBUG -MT google/protobuf/no_warning_test-map_lite_unittest.pb.o -MD -MP -MF google/protobuf/.deps/no_warning_test-map_lite_unittest.pb.Tpo -c -o google/protobuf/no_warning_test-map_lite_unittest.pb.o
test -f 'google/protobuf/map_lite_unittest.pb.cc' || echo './'
google/protobuf/map_lite_unittest.pb.ccIn file included from ./google/protobuf/map_type_handler.h:34,
from ./google/protobuf/map.h:51,
from ./google/protobuf/generated_message_table_driven.h:34,
from ./google/protobuf/map_lite_unittest.pb.h:26,
from google/protobuf/map_lite_unittest.pb.cc:4:
./google/protobuf/parse_context.h: In instantiation of 'bool google::protobuf::internal::ExpectTag(const char*) [with unsigned int tag = 130]':
google/protobuf/map_lite_unittest.pb.cc:1593:73: required from here
./google/protobuf/parse_context.h:398:17: error: comparison is always false due to limited range of data type [-Werror=type-limits]
398 | return ptr == tag;
| ~~~~~^~~~~~
./google/protobuf/parse_context.h: In instantiation of 'bool google::protobuf::internal::ExpectTag(const char) [with unsigned int tag = 138]':
google/protobuf/map_lite_unittest.pb.cc:1605:73: required from here
./google/protobuf/parse_context.h:398:17: error: comparison is always false due to limited range of data type [-Werror=type-limits]
./google/protobuf/parse_context.h: In instantiation of 'bool google::protobuf::internal::ExpectTag(const char*) [with unsigned int tag = 146]':
google/protobuf/map_lite_unittest.pb.cc:1617:73: required from here
./google/protobuf/parse_context.h:398:17: error: comparison is always false due to limited range of data type [-Werror=type-limits]
./google/protobuf/parse_context.h: In instantiation of 'bool google::protobuf::internal::ExpectTag(const char*) [with unsigned int tag = 810]':
google/protobuf/map_lite_unittest.pb.cc:4074:73: required from here
./google/protobuf/parse_context.h:398:17: error: comparison is always false due to limited range of data type [-Werror=type-limits]
./google/protobuf/parse_context.h: In instantiation of 'bool google::protobuf::internal::ExpectTag(const char*) [with unsigned int tag = 818]':
google/protobuf/map_lite_unittest.pb.cc:4087:73: required from here
./google/protobuf/parse_context.h:398:17: error: comparison is always false due to limited range of data type [-Werror=type-limits]
cc1plus: all warnings being treated as errors
make[2]: *** [Makefile:4403: google/protobuf/no_warning_test-map_lite_unittest.pb.o] Error 1
make[2]: Leaving directory '/tmp/protobuf/src'
make[1]: *** [Makefile:8191: check-am] Error 2
make[1]: Leaving directory '/tmp/protobuf/src'
make: *** [Makefile:1849: check-recursive] Error 1
The text was updated successfully, but these errors were encountered: