diff options
author | Javier Miranda <miranda@adacore.com> | 2018-05-29 09:42:34 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> | 2018-05-29 09:42:34 +0000 |
commit | 656412552b7c8d29090dfec239f51aa33f760c77 (patch) | |
tree | 54a8540e8eba293025f539857abb35e53efb4271 /gcc/tree-cfg.c | |
parent | 999acab61b42c6641f7be13aa6a6452587106d43 (diff) | |
download | gcc-656412552b7c8d29090dfec239f51aa33f760c77.zip gcc-656412552b7c8d29090dfec239f51aa33f760c77.tar.gz gcc-656412552b7c8d29090dfec239f51aa33f760c77.tar.bz2 |
[Ada] Wrong equality on untagged private type
When a private type declaration T1 is completed with a derivation of an
untagged private type that overrides the predefined equality primitive, and the
full view of T2 is a derivation of another private type T2 whose full view is a
tagged type, the compiler may generate code that references the wrong equality
primitive when processing comparisons of objects of type T1.
2018-05-29 Javier Miranda <miranda@adacore.com>
gcc/ada/
* exp_ch4.adb (Expand_N_Op_Eq, Expand_Composite_Equality): Use the new
subprogram Inherits_From_Tagged_Full_View to identify more reliably
untagged private types completed with a derivation of an untagged
private whose full view is a tagged type.
* sem_util.ads, sem_util.adb (Inherits_From_Tagged_Full_View): New
subprogram.
(Collect_Primitive_Operations): Handle untagged private types completed
with a derivation of an untagged private type whose full view is a
tagged type. In such case, collecting the list of primitives we may
find two equality primitives: one associated with the untagged private
and another associated with the ultimate tagged type (and we must
remove from the returned list this latter one).
gcc/testsuite/
* gnat.dg/equal2.adb: New testcase.
From-SVN: r260886
Diffstat (limited to 'gcc/tree-cfg.c')
0 files changed, 0 insertions, 0 deletions