https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93621
--- Comment #12 from Jan Hubicka <hubicka at ucw dot cz> --- > Having said that, I am not sure where to best fix this so late in the > GCC 10 development cycle. So the problem is that thunk is expanded on the adjusted decl but we still keep the adjustments and later fail to apply them? I guess we have two options: 1) force thunk expansion to happen on original decls (before cloning) so the body ends up being same as for ordinary function 2) remove the adjustments after expansion - this should IMO work under the assumption that optimization passes don't insert non-trivial code into the thunk before they expand the thunk (i.e. if you want to adjust it in ipa-sra you will want to first produce the thunk and then do adjustement) It seems to me that 2 should be not that hard to implement Does that make sense? Honza