undefined behavior in GMP 5.1.2

Marc Glisse marc.glisse at inria.fr
Mon Sep 23 12:49:36 CEST 2013


On Mon, 23 Sep 2013, Vincent Lefevre wrote:

> On 2013-09-23 10:05:35 +0200, Vincent Lefevre wrote:
>> On 2013-09-23 07:31:05 +0200, Marc Glisse wrote:
>>> On Mon, 23 Sep 2013, Vincent Lefevre wrote:
>>>
>>>> On 2013-09-21 11:57:42 +0200, Marc Glisse wrote:
>>>>>>> mul.c:81:31: runtime error: signed integer overflow:
>>>>>>> -5260204364771764878 + -5260204364771764878 cannot be represented in
>>>>>>> type 'long'
>>>>>
>>>>> We don't check for underflow in mpf multiplication, I didn't touch that.
>>>>> People should use mpfr ;-)
>>>>
>>>> Shouldn't the test be removed since it is known to be buggy?
>>>
>>> I didn't study the test closely, I was waiting to see if someone had an
>>> opinion on it.
>>
>> Actually the test triggering the integer overflow is
>>
>>     { "%10.2Ff",    "0.25", "      0.25" },
>>
>> If there's an underflow in mpf there, that seems to be a real bug.
>
> This is not due to underflow. This one is due to the call to
> mpn_get_d with a negative exp, so that the bug is the same as
> the one already reported.

Ok, thanks. In my opinion this misplaced warning is a bug in the sanitizer 
then.

-- 
Marc Glisse


More information about the gmp-bugs mailing list