]> git.ipfire.org Git - thirdparty/gcc.git/commit
ada: Fix internal error on ambiguous operands of comparison operator
authorEric Botcazou <ebotcazou@adacore.com>
Mon, 16 Sep 2024 06:31:57 +0000 (08:31 +0200)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Fri, 25 Oct 2024 09:09:00 +0000 (11:09 +0200)
commit104f8ad0ad4e0adb542bcf062c6a1009661fb4c1
tree542c7d3dbbeb94436ccb79ef343eb5bf1f65fcce
parentd6f9774b780150c1cbb58d43a0f1f36c2da0e2c7
ada: Fix internal error on ambiguous operands of comparison operator

This is a regression introduced when the diagnosis of ambiguous operands
for comparison and equality operators was moved from the analysis to the
resolution phase in order to avoid spurious ambiguities in specific cases.

When an ambiguity is detected for the operands of predefined comparison
and equality operators during analysis, it needs to be recorded so that
later calls to the disambiguation routine know about this ambiguity for
the case where the context has been resolved to boolean.

gcc/ada/ChangeLog:

* sem_type.ads (Interp ): Add Opnd_Typ component and remove default
value for Abstract_Op component.
(Add_One_Interp): Rename Opnd_Type parameter to Opnd_Typ.
* sem_type.adb (Add_One_Interp): Likewise.
(Add_One_Interp.Add_Entry): Record the operand type as well.
(Collect_Interp): Record Empty for the operand type.
(Disambiguate.Is_Ambiguous_Boolean_Operator): New predicate.
(Disambiguate): Use it to detect recorded ambiguity cases.
* sem_ch4.adb (Find_Comparison_Equality_Types): Add commentary.
gcc/ada/sem_ch4.adb
gcc/ada/sem_type.adb
gcc/ada/sem_type.ads