[Bug c++/70495] New: false warning: comparison between signed and unsigned integer expressions
andras.szilard at gmail dot com
gcc-bugzilla@gcc.gnu.org
Fri Apr 1 09:27:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70495
Bug ID: 70495
Summary: false warning: comparison between signed and unsigned
integer expressions
Product: gcc
Version: 5.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: andras.szilard at gmail dot com
Target Milestone: ---
Hi,
I have the strange warning "comparison between signed and unsigned integer
expressions" when only unsigned types are used (more than 2 members).
Simplest example (I could find):
uint32_t a = 0;
uint8_t b = 0;
a < b + b + b;
Some more details: http://coliru.stacked-crooked.com/a/816fde87f946dcad
Side notes:
- Originally I used size_t instead of uint32_t (as in my real-life code).
- Using uint16_t instead of uint32_t / size_t does not give this warning.
- clang++ does not give this warning.
Tested the sample code with these g++ compiler versions: 4.8.4, 5.3.0 and
5.3.1.
Please, clarify what is going on! :)
Thanks in advance!
More information about the Gcc-bugs
mailing list