https://gcc.gnu.org/g:7fce8735baf3160ff8c0952d1944c1216a0d9374
commit r15-1266-g7fce8735baf3160ff8c0952d1944c1216a0d9374 Author: Steve Baird <ba...@adacore.com> Date: Tue Apr 23 19:10:34 2024 -0700 ada: Reject too-strict alignment specifications. In some cases the compiler incorrectly concludes that a package body is required for a package specification that includes the implicit declaration of one or more inherited subprograms for an explicitly declared derived type. Spurious error messages (e.g., "cannot generate code for file") may result. gcc/ada/ * sem_ch7.adb (Requires_Completion_In_Body): Modify the Comes_From_Source test so that the implicit declaration of an inherited subprogram does not cause an incorrect result of True. Diff: --- gcc/ada/sem_ch7.adb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gcc/ada/sem_ch7.adb b/gcc/ada/sem_ch7.adb index 09d85bea335a..0f0fc90ad6b7 100644 --- a/gcc/ada/sem_ch7.adb +++ b/gcc/ada/sem_ch7.adb @@ -2827,13 +2827,14 @@ package body Sem_Ch7 is -- Otherwise test to see if entity requires a completion. Note that -- subprogram entities whose declaration does not come from source are -- ignored here on the basis that we assume the expander will provide an - -- implicit completion at some point. + -- implicit completion at some point. In particular, an inherited + -- subprogram of a derived type should not cause us to return True here. elsif (Is_Overloadable (Id) and then Ekind (Id) not in E_Enumeration_Literal | E_Operator and then not Is_Abstract_Subprogram (Id) and then not Has_Completion (Id) - and then Comes_From_Source (Parent (Id))) + and then Comes_From_Source (Id)) or else (Ekind (Id) = E_Package