[Bug target/94121] ICE on aarch64-linux-gnu: in abs_hwi, at hwint.h:324

marxin at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Mar 11 12:01:58 GMT 2020


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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |marxin at gcc dot gnu.org

--- Comment #6 from Martin Liška <marxin at gcc dot gnu.org> ---
commit r10-7123-g42bc589e87a326282be2156ddeb18588677c645d
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Mar 11 10:54:22 2020 +0100

    aarch64: Fix ICE in aarch64_add_offset_1 [PR94121]

    abs_hwi asserts that the argument is not HOST_WIDE_INT_MIN and as the
    (invalid) testcase shows, the function can be called with such an offset.
    The following patch is IMHO minimal fix, absu_hwi unlike abs_hwi allows
even
    that value and will return (unsigned HOST_WIDE_INT) HOST_WIDE_INT_MIN
    in that case.  The function then uses moffset in two spots which wouldn't
    care if the value is (unsigned HOST_WIDE_INT) HOST_WIDE_INT_MIN or
    HOST_WIDE_INT_MIN and wouldn't accept it (!moffset and
    aarch64_uimm12_shift (moffset)), then in one spot where the signedness of
    moffset does matter and using unsigned is the right thing -
    moffset < 0x1000000 - and finally has code which will handle even this
    value right; the assembler doesn't really care for DImode immediates if
            mov     x1, -9223372036854775808
    or
            mov     x1, 9223372036854775808
    is used and similarly it doesn't matter if we add or sub it in DImode.

    2020-03-11  Jakub Jelinek  <jakub@redhat.com>

            PR target/94121
            * config/aarch64/aarch64.c (aarch64_add_offset_1): Use absu_hwi
            instead of abs_hwi, change moffset type to unsigned HOST_WIDE_INT.

            * gcc.dg/pr94121.c: New test.


More information about the Gcc-bugs mailing list