https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110533
--- Comment #2 from Uroš Bizjak <ubizjak at gmail dot com> --- (In reply to Andrew Pinski from comment #1) > >clobbering other parameters and callee-saved registers. > > > (insn 2 8 3 2 (set (reg:DI 84) > (reg:DI 5 di [ aD.2522 ])) "/app/example.cpp":3:25 -1 > (nil)) > (insn 3 2 4 2 (set (reg:DI 85) > (reg:DI 4 si [ aD.2522+8 ])) "/app/example.cpp":3:25 -1 > (nil)) > (insn 4 3 5 2 (set (reg:TI 83) > (subreg:TI (reg:DI 84) 0)) "/app/example.cpp":3:25 -1 > (nil)) > (insn 5 4 6 2 (set (subreg:DI (reg:TI 83) 8) > (reg:DI 85)) "/app/example.cpp":3:25 -1 > (nil)) > (insn 6 5 7 2 (set (reg/v:TI 82 [ aD.2522 ]) > (reg:TI 83)) "/app/example.cpp":3:25 -1 > (nil)) This is emitted by middle-end to reconstruct a function argument in cases when argument is passed via multiple registers. Function argument is specified by the same hook that is used for the caller and the callee, so it is not possible to simple disable it for naked functions. When -O2 is used, optimizers figure out that the reconstructed value is unused and remove the whole reconstruction sequence. This is unfortunately not the case with -O0. So, middle-end should provide some sort of mechanism to suppress the generation of reconstruction sequence. The above sequence is emitted in function.cc/assign_parm_remove_parallels, but similar functionality can probably be found elsewhere in the function handling code. Or only pass simple arguments to naked function. Naked functions are specialist's tool, not intended for "general public".