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
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
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113852
Richard Biener changed:
What|Removed |Added
CC||rguenth at gcc dot gnu.org
---
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
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
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
>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113852
Jonathan Wakely changed:
What|Removed |Added
Keywords||diagnostic
Ever confirmed|0
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."