From 988f0466e80a6e4cc758f4df387b6c021b1cb078 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Sat, 10 Oct 2020 22:16:59 +0200 Subject: [PATCH] Fix ICE in remap_arguments with removed parameters. * ipa-modref.c (remap_arguments): Check range in map access. --- gcc/ipa-modref.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gcc/ipa-modref.c b/gcc/ipa-modref.c index 4330b9ec10e..0fbb943e57c 100644 --- a/gcc/ipa-modref.c +++ b/gcc/ipa-modref.c @@ -1333,7 +1333,12 @@ remap_arguments (vec *map, modref_records *tt) modref_access_node *access_node; FOR_EACH_VEC_SAFE_ELT (ref_node->accesses, k, access_node) if (access_node->parm_index > 0) - access_node->parm_index = (*map)[access_node->parm_index]; + { + if (access_node->parm_index < (int)map->length ()) + access_node->parm_index = (*map)[access_node->parm_index]; + else + access_node->parm_index = -1; + } } } } -- 2.30.2