]> gcc.gnu.org Git - gcc.git/commit
c: Fix up error-recovery on non-empty VLA initializers [PR109409]
authorJakub Jelinek <jakub@redhat.com>
Thu, 27 Apr 2023 09:36:54 +0000 (11:36 +0200)
committerJakub Jelinek <jakub@redhat.com>
Thu, 27 Apr 2023 09:36:54 +0000 (11:36 +0200)
commitd8842271ebf9a81128df9ae80e1d3b688749eac8
tree5615b5210e51da44bf0fd804b407e97eac567e31
parenta1030fbf70eef5b635e4fbb904ec7209ebd137ca
c: Fix up error-recovery on non-empty VLA initializers [PR109409]

On the following testcase we ICE, because after we emit the
variable-sized object may not be initialized except with an empty initializer
error we don't really reset the initializer to error_mark_node and then at
-Wformat checking time we ICE on seeing STRING_CST initializer for a VLA.

The following patch just arranges for error_mark_node to be returned after
the error diagnostics.

2023-04-27  Jakub Jelinek  <jakub@redhat.com>

PR c/109409
* c-parser.cc (c_parser_initializer): Move diagnostics about
initialization of variable sized object with non-empty initializer
after c_parser_expr_no_commas call and ret.set_error (); after it.

* gcc.dg/pr109409.c: New test.
gcc/c/c-parser.cc
gcc/testsuite/gcc.dg/pr109409.c [new file with mode: 0644]
This page took 0.063512 seconds and 5 git commands to generate.