From: Richard Biener Date: Thu, 7 Jan 2021 15:52:38 +0000 (+0100) Subject: fix GIMPLE parser for loops X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d54029179cbe817eaf9b6899339b0151cff3c00e;p=gcc.git fix GIMPLE parser for loops We do not tolerate "growing" a vector to a lower size. 2021-01-07 Richard Biener gcc/c/ * gimple-parser.c (c_parser_gimple_compound_statement): Only reallocate loop array if it is too small. --- diff --git a/gcc/c/gimple-parser.c b/gcc/c/gimple-parser.c index e64c6e5ebd5..58b161b7c76 100644 --- a/gcc/c/gimple-parser.c +++ b/gcc/c/gimple-parser.c @@ -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);