]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Reject too-strict alignment specifications.
authorSteve Baird <baird@adacore.com>
Wed, 24 Apr 2024 02:10:34 +0000 (19:10 -0700)
committerMarc Poulhiès <poulhies@adacore.com>
Thu, 13 Jun 2024 13:30:29 +0000 (15:30 +0200)
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.

gcc/ada/sem_ch7.adb

index 09d85bea335a2af3d28c27410428d9ec978ec23d..0f0fc90ad6b735b3e3691188b1bb82fd4414dc94 100644 (file)
@@ -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