aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Baird <baird@adacore.com>2024-04-23 19:10:34 -0700
committerMarc Poulhiès <poulhies@adacore.com>2024-06-13 15:30:29 +0200
commit7fce8735baf3160ff8c0952d1944c1216a0d9374 (patch)
tree229439061915400dfcb1fa44f1009e20447f0fe1
parent01f8250bc88c154c3996621b577adbfca073a382 (diff)
downloadgcc-7fce8735baf3160ff8c0952d1944c1216a0d9374.zip
gcc-7fce8735baf3160ff8c0952d1944c1216a0d9374.tar.gz
gcc-7fce8735baf3160ff8c0952d1944c1216a0d9374.tar.bz2
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.
-rw-r--r--gcc/ada/sem_ch7.adb5
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/ada/sem_ch7.adb b/gcc/ada/sem_ch7.adb
index 09d85be..0f0fc90 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