aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEd Schonberg <schonberg@adacore.com>2009-06-23 09:25:20 +0000
committerArnaud Charlet <charlet@gcc.gnu.org>2009-06-23 11:25:20 +0200
commitaf268547dec49c0356f622369582fe2e2d112586 (patch)
tree081eedd1be25cb10c2dfa1d7677f74523d56523d /gcc
parenta3e3b8daed9866b18e4a059f58989f42f23dc393 (diff)
downloadgcc-af268547dec49c0356f622369582fe2e2d112586.zip
gcc-af268547dec49c0356f622369582fe2e2d112586.tar.gz
gcc-af268547dec49c0356f622369582fe2e2d112586.tar.bz2
sem_ch3.adb (Derive_Subprogram): If the inherited subprogram is a primitive equality include it with its source...
2009-06-23 Ed Schonberg <schonberg@adacore.com> * sem_ch3.adb (Derive_Subprogram): If the inherited subprogram is a primitive equality include it with its source name even if the operation is currently invisible, to make sure that the corresponding slot in the dispatch table is reserved for the internal equality subsequently generated during expansion. From-SVN: r148834
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog8
-rw-r--r--gcc/ada/sem_ch3.adb22
2 files changed, 29 insertions, 1 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 7b55a04..69ea312 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,11 @@
+2009-06-23 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch3.adb (Derive_Subprogram): If the inherited subprogram is a
+ primitive equality include it with its source name even if the
+ operation is currently invisible, to make sure that the corresponding
+ slot in the dispatch table is reserved for the internal equality
+ subsequently generated during expansion.
+
2009-06-23 Matthew Gingell <gingell@adacore.com>
* Makefile.rtl, a-stwiha.adb: Add a-stwiha.adb back.
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index 4761682..df1a500 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -12034,6 +12034,26 @@ package body Sem_Ch3 is
then
Set_Derived_Name;
+ -- An inherited dispatching equality will be overridden by an internally
+ -- generated one, or by an explicit one, so preserve its name and thus
+ -- its entry in the dispatch table. Otherwise, if Parent_Subp is a
+ -- private operation it may become invisible if the full view has
+ -- progenitors, and the dispatch table will be malformed.
+ -- We check that the type is limited to handle the anomalous declaration
+ -- of Limited_Controlled, which is derived from a non-limited type, and
+ -- which is handled specially elsewhere as well.
+
+ elsif Chars (Parent_Subp) = Name_Op_Eq
+ and then Is_Dispatching_Operation (Parent_Subp)
+ and then Etype (Parent_Subp) = Standard_Boolean
+ and then
+ not Is_Limited_Type (Etype (First_Formal (Parent_Subp)))
+ and then
+ Etype (First_Formal (Parent_Subp))
+ = Etype (Next_Formal (First_Formal (Parent_Subp)))
+ then
+ Set_Derived_Name;
+
-- If parent is hidden, this can be a regular derivation if the
-- parent is immediately visible in a non-instantiating context,
-- or if we are in the private part of an instance. This test
@@ -12065,7 +12085,7 @@ package body Sem_Ch3 is
elsif Parent_Overrides_Interface_Primitive then
Set_Derived_Name;
- -- The type is inheriting a private operation, so enter
+ -- Otherwise, the type is inheriting a private operation, so enter
-- it with a special name so it can't be overridden.
else