This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/77436] Incorrect constant result for summing loop inserted
- From: "gcc-bugzilla at lucaswerkmeister dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 31 Aug 2016 22:03:05 +0000
- Subject: [Bug c/77436] Incorrect constant result for summing loop inserted
- Auto-submitted: auto-generated
- References: <bug-77436-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77436
--- Comment #3 from Lucas Werkmeister <gcc-bugzilla at lucaswerkmeister dot de> ---
Sorry, I wasn’t aware that wrapping is defined but overflow isn’t. The bug also
happens if the summand type is changed to long (or, precisely, int64_t), where
overflow shouldn’t happen (we’re adding at most 2^31 integers with the same
sign, each of which doesn’t exceed 2^31 in magnitude, so 2^63 should be enough
for the sum).