undefined behavior in GMP 5.1.2

Vincent Lefevre vincent at vinc17.net
Mon Sep 23 10:05:35 CEST 2013


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.

-- 
Vincent Lefèvre <vincent at vinc17.net> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


More information about the gmp-bugs mailing list