]> gcc.gnu.org Git - gcc.git/commit
c-family: Fix ICE in get_atomic_generic_size [PR96545]
authorJakub Jelinek <jakub@redhat.com>
Tue, 11 Aug 2020 14:46:49 +0000 (16:46 +0200)
committerJakub Jelinek <jakub@redhat.com>
Tue, 25 Aug 2020 14:54:20 +0000 (16:54 +0200)
commitb9bb6a5e12cae44a1cbf298b69f28fc6871f81c8
tree08fdc58611f32a6d3c74da878c14df34edf3b760
parentdb00336a49707327552e678b59da8e85384bdae6
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.

(cherry picked from commit 7840b4dc05539cf5575b3e9ff57ff5f6c3da2cae)
gcc/c-family/c-common.c
gcc/testsuite/c-c++-common/pr96545.c [new file with mode: 0644]
This page took 0.06541 seconds and 5 git commands to generate.