[Ada] Wrong resolution of equality operator with overloaded operand
authorEd Schonberg <schonberg@adacore.com>
Tue, 9 Jul 2019 07:54:35 +0000 (07:54 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Tue, 9 Jul 2019 07:54:35 +0000 (07:54 +0000)
commit0ce858310c2bba03fc030f34f4217cb405020bcf
tree3f82d544f2d5d5e3a266c7624bc811652b51e7fc
parent16cc65b61a7c00920ff66d45d3b23a9e313dd1b8
[Ada] Wrong resolution of equality operator with overloaded operand

This patch fixes a code generation error on an equality operation one of
whose operands is an overloaded call, and several equality operators are
visible. The resolution would succes but in some cases the wrong entity
was lwfton the equality node, leading to expansion with the wrong
interpretation.  If the equality operation is the operand of a negation,
the resolution of the negation must make direct use of the equality
resolution,

2019-07-09  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

* sem_res.adb (Resolve_Equality_Op): If the node was overloaded,
set properly the entity to which the node has been resolved. The
original entity is the first one found during analysis, and is
not necessarily the resolved one.
(Resolve_Op_Not): If the argument of negation is an overloaded
equality operation, call its resolution directly given that the
context type does not participate in overload resolution.

gcc/testsuite/

* gnat.dg/equal7.adb, gnat.dg/equal7_pkg.adb,
gnat.dg/equal7_pkg.ads: New testcase.

From-SVN: r273281
gcc/ada/ChangeLog
gcc/ada/sem_res.adb
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/equal7.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/equal7_pkg.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/equal7_pkg.ads [new file with mode: 0644]