fix GIMPLE parser for loops

We do not tolerate "growing" a vector to a lower size.

2021-01-07  Richard Biener  <rguenther@suse.de>

gcc/c/
	* gimple-parser.c (c_parser_gimple_compound_statement): Only
	reallocate loop array if it is too small.
This commit is contained in:
Richard Biener 2021-01-07 16:52:38 +01:00
parent 6bca2ebf10
commit d54029179c

View File

@ -616,8 +616,9 @@ c_parser_gimple_compound_statement (gimple_parser &parser, gimple_seq *seq)
class loop *loop = alloc_loop ();
loop->num = is_loop_header_of;
loop->header = bb;
vec_safe_grow_cleared (loops_for_fn (cfun)->larray,
is_loop_header_of + 1, true);
if (number_of_loops (cfun) <= (unsigned)is_loop_header_of)
vec_safe_grow_cleared (loops_for_fn (cfun)->larray,
is_loop_header_of + 1, true);
(*loops_for_fn (cfun)->larray)[is_loop_header_of] = loop;
flow_loop_tree_node_add (loops_for_fn (cfun)->tree_root,
loop);