]> gcc.gnu.org Git - gcc.git/commit - gcc/c/ChangeLog
c: ignore initializers for elements of variable-size types [PR93577]
authorJoseph Myers <joseph@codesourcery.com>
Thu, 5 Mar 2020 23:48:06 +0000 (23:48 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Thu, 5 Mar 2020 23:48:06 +0000 (23:48 +0000)
commitc9d70946b3c9f10cfd560407aac8b0b4515f10b6
tree7c33f8f5efb0edd9f96cdbd80efd4cb0eca7b813
parent8c044c65773398096c3fe7d396b0a95eb8b97e17
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.
gcc/c/ChangeLog
gcc/c/c-typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr93577-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/pr93577-2.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/pr93577-3.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/pr93577-4.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/pr93577-5.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/pr93577-6.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/vla-init-1.c
This page took 0.063834 seconds and 5 git commands to generate.