[Bug c/96545] ICE in get_atomic_generic_size

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Aug 11 14:47:37 GMT 2020


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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:7840b4dc05539cf5575b3e9ff57ff5f6c3da2cae

commit r11-2648-g7840b4dc05539cf5575b3e9ff57ff5f6c3da2cae
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Aug 11 16:46:49 2020 +0200

    c-family: Fix ICE in get_atomic_generic_size [PR96545]

    As the testcase shows, we would ICE if the type of the first argument of
    various atomic builtins was pointer to (non-void) incomplete type, we would
    assume that TYPE_SIZE_UNIT must be non-NULL.  This patch diagnoses it
    instead.  And also changes the TREE_CODE != INTEGER_CST check to
    !tree_fits_uhwi_p, as we use tree_to_uhwi after this and at least in theory
    the int could be too large and not fit.

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

            PR c/96545
            * c-common.c (get_atomic_generic_size): Require that first
argument's
            type points to a complete type and use tree_fits_uhwi_p instead of
            just INTEGER_CST TREE_CODE check for the TYPE_SIZE_UNIT.

            * c-c++-common/pr96545.c: New test.


More information about the Gcc-bugs mailing list