[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
INT_ADD_WRAPV and friends - bug fixed
From: |
Paul Eggert |
Subject: |
INT_ADD_WRAPV and friends - bug fixed |
Date: |
Wed, 14 Aug 2019 17:48:04 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 |
Eli Zaretskii wrote:
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=37006
Thanks for reporting that bug. I fixed it by installing the attached into
Gnulib. While working on the fix I discovered and reported a bug in GCC's
integer-overflow builtins: see:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91450
The new Gnulib code works around this GCC bug.
As you can see by inspecting the patch, it can be surprisingly difficult to do
integer overflow checking correctly for all edge cases, particularly given the
compiler bugs in this area. For example, the Gnulib code simply ignores Clang's
integer-overflow builtins, because working around Clang's builtins' bugs is more
trouble than it's worth.
Ad-hoc integer-overflow checking is unfortunately quite error-prone in C-like
languages, which why INT_ADD_WRAPV etc. are useful.
0001-intprops-support-unsigned-_WRAPV-results.patch
Description: Text Data