https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89609
--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Marc Poulhies <[email protected]>: https://gcc.gnu.org/g:7fcbb81f0c9266147bea509f7c01b1e96f2a171f commit r17-1211-g7fcbb81f0c9266147bea509f7c01b1e96f2a171f Author: Eric Botcazou <[email protected]> Date: Mon Feb 9 09:40:18 2026 +0100 ada: Adjust RESULT_DECL of functions after updating their profile if needed Adjusting the RESULT_DECL of functions is necessary before handing them over to the middle-end when they return by invisible reference and are defined in the current translation unit, so that's done in Subprogram_Body_to_gnu. That's also needed when the functions are generated by the middle-end, like GNU thunks. But, in this case, the transformation can only be applied when the full view of the type is available, which is not guaranteed by the time maybe_make_gnu_thunk is invoked, so the transformation needs to be delayed and applied by update_profile when the full view is eventually encountered. gcc/ada/ChangeLog: PR ada/89609 * gcc-interface/gigi.h (adjust_result_decl_for_invisible_reference): New inline function. * gcc-interface/decl.cc (update_profile): Adjust the RESULT_DECL of the function if it returns by invisible reference. * gcc-interface/trans.cc (Subprogram_Body_to_gnu): Replace manual adjustment by a call to adjust_result_decl_for_invisible_reference. (maybe_make_gnu_thunk): Likewise. * gcc-interface/targtyps.cc: Include stor-layout.h header file.
