qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PULL 3/5] target/m68k: add fmod/frem


From: Peter Maydell
Subject: Re: [Qemu-devel] [PULL 3/5] target/m68k: add fmod/frem
Date: Tue, 8 May 2018 11:27:31 +0100

On 4 March 2018 at 17:32, Laurent Vivier <address@hidden> wrote:
> Using a local m68k floatx80_mod()
> [copied from previous:
> Written by Andreas Grabher for Previous, NeXT Computer Emulator.]
>
> The quotient byte of the FPSR is updated with
> the result of the operation.
>
> Signed-off-by: Laurent Vivier <address@hidden>
> Reviewed-by: Richard Henderson <address@hidden>
> Message-Id: <address@hidden>

Hi; Coverity points out that there's a bug in the
floatx80_mod() function this patch introduces (CID 1390568):

> +    expDiff -= 64;
> +    while (0 < expDiff) {
> +        qTemp = estimateDiv128To64(aSig0, aSig1, bSig);
> +        qTemp = (2 < qTemp) ? qTemp - 2 : 0;
> +        mul64To128(bSig, qTemp, &term0, &term1);
> +        sub128(aSig0, aSig1, term0, term1, &aSig0, &aSig1);
> +        shortShift128Left(aSig0, aSig1, 62, &aSig0, &aSig1);
> +    }

This loop condition checks expDiff, but the loop body
never changes that variable, so if we go round the loop
at all then we'll do so forever.

thanks
-- PMM



reply via email to

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