]> git.ipfire.org Git - thirdparty/gcc.git/commit
gimple-fold: Handle bitfields in fold_const_aggregate_ref_1 [PR93121]
authorJakub Jelinek <jakub@redhat.com>
Mon, 20 Jul 2020 08:24:19 +0000 (10:24 +0200)
committerGiuliano Belinassi <giuliano.belinassi@usp.br>
Mon, 17 Aug 2020 16:18:34 +0000 (13:18 -0300)
commit7fcef5409d768205050b4b82b89dc73bc97d4f87
tree3a27039c404b0b0c89f54486feea970c4c243943
parent09fdf69753a2064004bf7a82c24d28187c66a66c
gimple-fold: Handle bitfields in fold_const_aggregate_ref_1 [PR93121]

When working on __builtin_bit_cast that needs to handle bitfields too,
I've made the following change to handle at least some bitfields in
fold_const_aggregate_ref_1 (those that have integral representative).
It already handles some, but only those that start and end at byte
boundaries.

2020-07-20  Jakub Jelinek  <jakub@redhat.com>

PR libstdc++/93121
* gimple-fold.c (fold_const_aggregate_ref_1): For COMPONENT_REF
of a bitfield not aligned on byte boundaries try to
fold_ctor_reference DECL_BIT_FIELD_REPRESENTATIVE if any and
adjust it depending on endianity.

* gcc.dg/tree-ssa/pr93121-2.c: New test.
gcc/gimple-fold.c
gcc/testsuite/gcc.dg/tree-ssa/pr93121-2.c [new file with mode: 0644]