[Bug c++/113852] -Wsign-compare doesn't warn on unsigned result types

2024-02-13 Thread rguenther at suse dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113852 --- Comment #8 from rguenther at suse dot de --- On Mon, 12 Feb 2024, admin at computerquip dot com wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113852 > > --- Comment #7 from Zachary L --- > (In reply to Richard Biener from comment

[Bug c++/113852] -Wsign-compare doesn't warn on unsigned result types

2024-02-12 Thread admin at computerquip dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113852 --- Comment #7 from Zachary L --- (In reply to Richard Biener from comment #6) > Well, given athat a1 * a2 is carried out in 'int' you are invoking undefined > behavior if it overflows. GCC assumes that doesn't happen so it's correct > to

[Bug c++/113852] -Wsign-compare doesn't warn on unsigned result types

2024-02-12 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113852 Richard Biener changed: What|Removed |Added CC||rguenth at gcc dot gnu.org ---

[Bug c++/113852] -Wsign-compare doesn't warn on unsigned result types

2024-02-09 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113852 --- Comment #5 from Jonathan Wakely --- The behaviour changed with r247495 common.opt (fstrict-overflow): Alias negative to fwrapv. 2017-05-02 Richard Biener * common.opt (fstrict-overflow): Alias negative to fwrapv. * doc/invoke.texi

[Bug c++/113852] -Wsign-compare doesn't warn on unsigned result types

2024-02-09 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113852 --- Comment #4 from Jonathan Wakely --- Reduced: int main() { unsigned short a1 = (1u << 16) - 1; unsigned short a2 = a1; /* a1 * a2 should be 4294836225 in math terms */ unsigned long long a3 = 4294836225; /* * The

[Bug c++/113852] -Wsign-compare doesn't warn on unsigned result types

2024-02-09 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113852 --- Comment #3 from Jonathan Wakely --- (In reply to Jonathan Wakely from comment #2) > I assume what's happening is that GCC assumes integer promotion from > uint16_t to int is value preserving and so we get two positive values, and >

[Bug c++/113852] -Wsign-compare doesn't warn on unsigned result types

2024-02-09 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113852 Jonathan Wakely changed: What|Removed |Added Keywords||diagnostic Ever confirmed|0

[Bug c++/113852] -Wsign-compare doesn't warn on unsigned result types

2024-02-09 Thread admin at computerquip dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113852 --- Comment #1 from Zachary L --- Sorry, that should say "If *both* a1 or a2 are constexpr, the warning will occur."