https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127880
--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-16 branch has been updated by Eric Botcazou <[email protected]>: https://gcc.gnu.org/g:7b252297337b7b8457e1ca73c94854c73d12d3fb commit r16-9786-g7b252297337b7b8457e1ca73c94854c73d12d3fb Author: Gary Dismukes <[email protected]> Date: Thu Jan 15 20:40:28 2026 +0000 Ada: Missing contract checks for calls to formal subprogram within instances While working on a visibility bug, it was noticed that preconditions on formal subprograms are not being checked on calls to the subprograms within package instantiations. The wrapper subprogram that is created to perform the check (and invoke the actual subprogram) was not being used as the target of calls, and the actual subprogram is being called instead (bypassing the check). This was due to the subprogram renaming created (for the actual-to-formal association) and the wrapper being homographs, and the loop over interpretations in Collect_Interps happening to resolve calls to the actual instead of the wrapper. This wrong resolution is avoided by removing the homographic subprogram renaming, so that the resolution can only resolve to the wrapper (which will only include the precondition check in the case where assertions are enabled). gcc/ada/ PR ada/127880 * sem_ch12.adb (Build_Subprogram_Wrapper): Remove the subprogram renaming created for the formal-to-actual association from the list of renamings (only when such a subprogram renaming is present). Also, change the name from plural to singular, since the procedure only creates one wrapper, update the spec comment to reflect that, and clarify the state and use of the Renamings parameter.
