https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63573
--- Comment #5 from Martin Liška <marxin at gcc dot gnu.org> --- Issue looks very similar, ICF identifies a pair of function which are transformed to thunk (with tail-call). Where: (gdb) call debug_gimple_stmt(stmt) # .MEM_3 = VDEF <.MEM_1(D)> encoding_json.error.pN25_encoding_json.encodeState.localalias.36 (d_2(D), err); [tail call] and: #9 0x00000000102a315c in expand_expr (exp=0x3fffa79d3940, target=0x3fffaf8d0400, mode=VOIDmode, modifier=EXPAND_NORMAL) at ../../gcc/expr.h:382 382 return expand_expr_real (exp, target, mode, modifier, NULL, false); (gdb) call debug_tree(exp) <call_expr 0x3fffa79d3940 type <void_type 0x3fffaf8b1260 asm_written VOID align 8 symtab 0 alias set -1 canonical type 0x3fffaf8b1260 pointer_to_this <pointer_type 0x3fffaf8b1308>> side-effects addressable protected fn <addr_expr 0x3fffafa9bc80 type <pointer_type 0x3fffafb60a80 type <function_type 0x3fffafb609d8> unsigned SI size <integer_cst 0x3fffaf881158 constant 32> unit size <integer_cst 0x3fffaf881170 constant 4> align 32 symtab 0 alias set -1 canonical type 0x3fffafb60a80> constant arg 0 <function_decl 0x3fffa792d728 encoding_json.error.pN25_encoding_json.encodeState.localalias.36 type <function_type 0x3fffafb609d8> addressable asm_written used SI file ../../../../libgo/go/encoding/json/encode.go line 272 col 1 align 32 result <result_decl 0x3fffb1851ab8 D.3022> (mem:SI (symbol_ref:SI ("encoding_json.error.pN25_encoding_json.encodeState.localalias.36") [flags 0x3] <function_decl 0x3fffa792d728 encoding_json.error.pN25_encoding_json.encodeState.localalias.36>) [0 S4 A8])>> arg 0 <ssa_name 0x3fffa7916078 type <pointer_type 0x3fffaf9e03f0 type <record_type 0x3fffaf8b8f10 .encoding/json.decodeState> sizes-gimplified asm_written public unsigned SI size <integer_cst 0x3fffaf881158 32> unit size <integer_cst 0x3fffaf881170 4> align 32 symtab 16383 alias set 5 canonical type 0x3fffaf9e03f0> visited var <parm_decl 0x3fffafad0980 d>def_stmt GIMPLE_NOP version 2 ptr-info 0x3fffa58b0c90> arg 1 <parm_decl 0x3fffafad0a00 err type <record_type 0x3fffaf8b6d98 error sizes-gimplified asm_written DI size <integer_cst 0x3fffaf8811b8 constant 64> unit size <integer_cst 0x3fffaf8811d0 constant 8> align 32 symtab 16383 alias set 28 canonical type 0x3fffaf8b6d98 fields <field_decl 0x3fffaf961138 __methods> pointer_to_this <pointer_type 0x3fffaf9a6708>> addressable used DI file ../../../../libgo/go/encoding/json/decode.go line 193 col 1 size <integer_cst 0x3fffaf8811b8 64> unit size <integer_cst 0x3fffaf8811d0 8> align 32 context <function_decl 0x3fffaf979f78 json.error.pN25_encoding_json.decodeState> (reg/v:DI 157 [ err ]) arg-type <record_type 0x3fffaf8b6d98 error> incoming-rtl (mem:DI (reg:SI 4 4) [0 S8 A8])>> (gdb) frame 1 (gdb) call debug_rtx(result) (reg/v:DI 157 [ err ]) Am I right that problem comes up from TREE_ADDRESSABLE flag set on arg 1 (err)? I would appreciate any hint how should be thunk creation fixed. Thank you, Martin