[PATCH] fix GIMPLE parser for loops
Richard Biener
rguenther@suse.de
Thu Jan 7 15:54:21 GMT 2021
We do not tolerate "growing" a vector to a lower size.
Bootstrap on x86_64-unknown-linux-gnu running, will commit
as obvious.
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.
---
gcc/c/gimple-parser.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/gcc/c/gimple-parser.c b/gcc/c/gimple-parser.c
index e64c6e5ebd5..724d8394b4f 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) <= 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);
--
2.26.2
More information about the Gcc-patches
mailing list