bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] intprops: add WRAPV and const flavors for GCC 5


From: Paul Eggert
Subject: Re: [PATCH] intprops: add WRAPV and const flavors for GCC 5
Date: Thu, 17 Dec 2015 13:02:47 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0

On 12/17/2015 06:19 AM, Pádraig Brady wrote:
-     long int result = INT_MULTIPLY_WRAPV (a, b);
+     long int result = a * b;

This doesn't look right, because a * b could overflow which would lead to undefined behavior. INT_MULTIPLY_WRAPV does not rely on undefined behavior due to integer overflow, which is the point of that example.

I tracked this down to what appears to be a compiler bug in GCC, filed a bug report with the GCC folks (GCC bug 68971), and installed the attached patch instead.

Attachment: 0001-intprops-test-work-around-GCC-bug-68971.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]