On 12/18/20 7:32 PM, Bruno Haible wrote: > Paul Eggert wrote: >>> Thanks for the heads-up. Indeed, what I understand from this bug report is >>> that >>> the condition code handling (required by __builtin_add_overflow on many >>> platforms) was unreliable before 2017-01-27, i.e. in GCC versions < 7. >>> So, gnulib shouldn't make use of it in these GCC versions. >> >> So the problem is on all platforms, not just s390x? > > That's my understanding, from the cited > <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98269>. > Even if I'm wrong, given that GCC 5 and 6 are in decreasing use, I feel it's > better to err on the safe side. > > Bruno >
According to Andreas comment in the gcc-bugzilla 98269, the issue was fixed with a common-code patch. On s390x this issue was hidden due to a s390-specific patch (committed before the common-code fix). Thus, I also think, that this bug could happen on all platforms, but I don't know if this really happens anywhere. The gcc-bugzilla 78559 (=> common-code patch) was reported on aarch64 for gcc > 6.2.1 && <= 7.0. (If you have an aarch64 system, you could try it) I've just build and run tst-gcc-addoverflow.c (attached to the gcc-bugzilla 98269) on x86_64 with gcc version 6.5.0 20181026 (Ubuntu 6.5.0-2ubuntu1~18.04) => __builtin_add_overflow() SUCCEED Florian Weimer added the usage of __builtin_add_overflow which fails with gcc 6.5 on s390x. After reporting the issue, he said, that he did not recognize the issue on other platforms. But I don't know which gcc versions or platforms he has used for testing. Thanks, Stefan