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

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

https://gcc.gnu.org/g:0673fc691175bfdb72d70c2fbbfcad238a3a9942

commit r11-5875-g0673fc691175bfdb72d70c2fbbfcad238a3a9942
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Wed Dec 9 09:36:11 2020 +0100

    fold-const: Fix native_encode_initializer bitfield handling [PR98199]

    With the bit_cast changes, I have added support for bitfields which don't
    have scalar representatives.  For bit_cast it works fine, as when mask
    is non-NULL, off is asserted to be 0.  But when native_encode_initializer
    is called e.g. from sccvn with off > 0 (i.e. we are interested in encoding
    just a few bytes out of it somewhere from the middle or at the end), the
    following computations are incorrect.
    pos is a byte position from the start of the constructor, repr_size is the
    size in bytes of the bit-field representative and len is the length
    of the buffer.  If the buffer is offsetted by positive off, those numbers
    are uncomparable though, we need to add off to len to make both
    count bytes from the start of the constructor, and o is a utility temporary
    set to off != -1 ? off : 0 (because off -1 also means start at offset 0
    and just force special behavior).

    2020-12-09  Jakub Jelinek  <ja...@redhat.com>

            PR tree-optimization/98199
            * fold-const.c (native_encode_initializer): Fix handling bit-fields
            when off > 0.

            * gcc.c-torture/compile/pr98199.c: New test.

Reply via email to