[Bug target/99184] [avr] wrong double to 16-Bit and 32-Bit integers in libgcc/libf7

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Sep 19 07:52:48 GMT 2022


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99184

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Richard Biener
<rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:175d6ba5f025c886f7f81bc8f9b24717da978933

commit r11-10263-g175d6ba5f025c886f7f81bc8f9b24717da978933
Author: Georg-Johann Lay <avr@gjlay.de>
Date:   Mon Sep 19 09:46:58 2022 +0200

    Fix PR target/99184: Wrong cast from double to 16-bit and 32-bit ints

    this patch fixed PR target/99184 which incorrectly rounded during 64-bit
    (long) double to 16-bit and 32-bit integers.

    The patch just removes the respective roundings from
    libf7-asm.sx::to_integer and ::to_unsigned.  Luckily, LibF7 does nowhere
    use respective functions internally, the only user is in libf7.c::f7_exp

    which reads

       f7_round (qq, qq);
       int16_t q = f7_get_s16 (qq);

    so that f7_get_s16() operates on an already rounded value, and therefore
    this code works unaltered with or without rounding in to_integer.

            PR target/99184
    libgcc/config/avr/libf7/
            * libf7-asm.sx (to_integer, to_unsigned): Don't round 16-bit
            and 32-bit integers.

    (cherry picked from commit 0b5b8ac5cb7fe92dd17ae8bd7de84640daa59e84)


More information about the Gcc-bugs mailing list