diff options
author | Richard Biener <rguenther@suse.de> | 2021-01-07 16:52:38 +0100 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2021-01-07 17:36:25 +0100 |
commit | d54029179cbe817eaf9b6899339b0151cff3c00e (patch) | |
tree | f90aea10c558303952a51e35e4ff18b655179ead /gcc/c | |
parent | 6bca2ebf10654b8beb5c5737c8652e8262901294 (diff) | |
download | gcc-d54029179cbe817eaf9b6899339b0151cff3c00e.zip gcc-d54029179cbe817eaf9b6899339b0151cff3c00e.tar.gz gcc-d54029179cbe817eaf9b6899339b0151cff3c00e.tar.bz2 |
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.
Diffstat (limited to 'gcc/c')
-rw-r--r-- | gcc/c/gimple-parser.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/c/gimple-parser.c b/gcc/c/gimple-parser.c index e64c6e5..58b161b 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); |