analyzer: fix ICE with negative bit offsets [PR96648]
authorDavid Malcolm <dmalcolm@redhat.com>
Tue, 18 Aug 2020 01:12:35 +0000 (21:12 -0400)
committerDavid Malcolm <dmalcolm@redhat.com>
Wed, 19 Aug 2020 01:20:18 +0000 (21:20 -0400)
commit400abebf48a90d0797718ab7c3864de331e85b70
tree3eb261b4c6667c41868f290af8477b8d30097419
parent5c265693bfa8e5f205e81c0452d54800334c32a9
analyzer: fix ICE with negative bit offsets [PR96648]

PR analyzer/96648 reports an ICE within get_field_at_bit_offset due
to a negative bit offset, arising due to pointer arithmetic.

This patch replaces an assertion with handling for this case, fixing the
ICE.

gcc/analyzer/ChangeLog:
PR analyzer/96648
* region.cc (get_field_at_bit_offset): Gracefully handle negative
values for bit_offset.

gcc/testsuite/ChangeLog:
PR analyzer/96648
* gcc.dg/analyzer/pr96648.c: New test.
gcc/analyzer/region.cc
gcc/testsuite/gcc.dg/analyzer/pr96648.c [new file with mode: 0644]