diff options
Diffstat (limited to 'gcc/tree-inline.c')
-rw-r--r-- | gcc/tree-inline.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index e292a14..b2c58ac 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -2117,7 +2117,13 @@ copy_bb (copy_body_data *id, basic_block bb, size_t nargs = nargs_caller; for (p = DECL_ARGUMENTS (id->src_fn); p; p = DECL_CHAIN (p)) - nargs--; + { + /* Avoid crashing on invalid IL that doesn't have a + varargs function or that passes not enough arguments. */ + if (nargs == 0) + break; + nargs--; + } /* Create the new array of arguments. */ size_t nargs_callee = gimple_call_num_args (call_stmt); |