Fix ICE in remap_arguments with removed parameters.
authorJan Hubicka <jh@suse.cz>
Sat, 10 Oct 2020 20:16:59 +0000 (22:16 +0200)
committerJan Hubicka <jh@suse.cz>
Sat, 10 Oct 2020 20:16:59 +0000 (22:16 +0200)
* ipa-modref.c (remap_arguments): Check range in map access.

gcc/ipa-modref.c

index 4330b9ec10ee5d8fb4e5d10e35f43c6a39d0336e..0fbb943e57c7fd27a203b8c7d9f4ff60fc861d17 100644 (file)
@@ -1333,7 +1333,12 @@ remap_arguments (vec <int> *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;
+             }
        }
     }
 }