https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84739
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Untested fix: --- gcc/tree-tailcall.c.jj 2018-01-12 11:35:51.470222838 +0100 +++ gcc/tree-tailcall.c 2018-03-06 23:05:39.779048759 +0100 @@ -481,7 +481,7 @@ find_tail_calls (basic_block bb, struct { tree arg; - for (param = DECL_ARGUMENTS (func), idx = 0; + for (param = DECL_ARGUMENTS (current_function_decl), idx = 0; param && idx < gimple_call_num_args (call); param = DECL_CHAIN (param), idx ++) { Wonder if the bug is also reproduceable when the gimple call has some different fntype.