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

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

https://gcc.gnu.org/g:2b99794806d83e47249fd7c05bf521caee1fdcd4

commit r11-8765-g2b99794806d83e47249fd7c05bf521caee1fdcd4
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Thu Jun 24 12:22:14 2021 +0200

    stor-layout: Avoid DECL_BIT_FIELD_REPRESENTATIVE with NULL TREE_TYPE
[PR101172]

    finish_bitfield_representative has an early out if the field after a
    bitfield has error_mark_node type, but that early out leads to TREE_TYPE
    of the DECL_BIT_FIELD_REPRESENTATIVE being NULL, which breaks assumptions
    on code that uses the DECL_BIT_FIELD_REPRESENTATIVE during error-recovery.

    The following patch instead sets TREE_TYPE of the representative to
    error_mark_node, something the users can deal with better.  At this point
    the representative can be set as DECL_BIT_FIELD_REPRESENTATIVE for multiple
    bitfields, so making sure that we clear the DECL_BIT_FIELD_REPRESENTATIVE
    instead would be harder (but doable, e.g. with the error_mark_node
TREE_TYPE
    set by this patch set some flag in the caller and if the flag is there,
walk
    all the fields once again and clear all DECL_BIT_FIELD_REPRESENTATIVE that
    have error_mark_node TREE_TYPE).

    2021-06-24  Jakub Jelinek  <ja...@redhat.com>

            PR middle-end/101172
            * stor-layout.c (finish_bitfield_representative): If nextf has
            error_mark_node type, set repr type to error_mark_node too.

            * gcc.dg/pr101172.c: New test.

    (cherry picked from commit 65371066d8967560e3508af4a804e0ddb90acee7)

Reply via email to