Skip to content
Snippets Groups Projects
Commit d8842271 authored by Jakub Jelinek's avatar Jakub Jelinek
Browse files

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.
parent a1030fbf
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment