https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81423

--- Comment #18 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Davin McCall from comment #15)
> Apologies if I'm wrong and just making noise but doesn't the test case
> involve a left shift of a value greater than the bit width of the left
> operand and therefore invoke UB?

The test as committed invokes UB, because the #c3 transcription into C omitted
the cast unsigned(5677365550390624949L - ll) from the original testcase.

Fixed thusly, I've additionally replaced all spots using L suffixes with LL for
consistent behavior on 32-bit targets, and add a test that int is 32-bit, for
say 16-bit int and 64-bit long long the testcase would have UB again (as well
as end up with a different than expected value anyway, as 3998784 doesn't fit
into 16-bit int.

Reply via email to