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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Joseph Myers <js...@gcc.gnu.org>:

https://gcc.gnu.org/g:c9d70946b3c9f10cfd560407aac8b0b4515f10b6

commit r10-7051-gc9d70946b3c9f10cfd560407aac8b0b4515f10b6
Author: Joseph Myers <jos...@codesourcery.com>
Date:   Thu Mar 5 23:48:06 2020 +0000

    c: ignore initializers for elements of variable-size types [PR93577]

    Bug 93577, apparently a regression (although it isn't very clear to me
    exactly when it was introduced; tests I made with various past
    compilers produced inconclusive results, including e.g. ICEs appearing
    with 64-bit-host compilers for some versions but not 32-bit-host
    compilers for the same versions) is an C front-end tree-checking ICE
    processing initializers for structs using the VLA-in-struct extension.
    There is an error for such initializers, but other processing that
    still takes place for them results in the ICE.

    This patch ensures that processing of initializers for variable-size
    types stops earlier to avoid the code that results in the ICE (and
    ensures it stops earlier for error_mark_node to avoid ICEs in the
    check for variable-size types), adjusts the conditions for the "empty
    scalar initializer" diagnostic to avoid consequent excess errors in
    the case of a bad type name, and adds tests for a few variations on
    what such initializers might look like, as well as tests for cases
    identified from ICEs seen with an earlier version of this patch.

    Bootstrapped with no regressions for x86_64-pc-linux-gnu.

        PR c/93577
    gcc/c:
        * c-typeck.c (pop_init_level): Do not diagnose initializers as
        empty when initialized type is error_mark_node.
        (set_designator, process_init_element): Ignore initializers for
        elements of a variable-size type or of error_mark_node.

    gcc/testsuite:
        * gcc.dg/pr93577-1.c, gcc.dg/pr93577-2.c, gcc.dg/pr93577-3.c,
        gcc.dg/pr93577-4.c, gcc.dg/pr93577-5.c, gcc.dg/pr93577-6.c: New
        tests.
        * gcc.dg/vla-init-1.c: Expect fewer errors about VLA initializer.

Reply via email to