https://gcc.gnu.org/g:f622acc1eb2679f14758a1ad6c5b693cd9bdea23

commit r15-6730-gf622acc1eb2679f14758a1ad6c5b693cd9bdea23
Author: Eric Botcazou <ebotca...@adacore.com>
Date:   Sun Jan 5 23:21:31 2025 +0100

    ada: Accept predefined multiply operator for fixed point in expression 
function
    
    The RM 4.5.5(19.1/2) subclause says that the predefined multiply operator
    for universal_fixed is still available, despite the declaration of a user-
    defined primitive multiply operator for the fixed-point type at stake, if
    it is identified using an expanded name with prefix denoting Standard, but
    this is currently not the case in the context of an expression function.
    
    gcc/ada/ChangeLog:
    
            PR ada/118274
            * sem_ch4.adb (Check_Arithmetic_Pair.Has_Fixed_Op): Use the original
            node of the operator to identify the case of an expanded name whose
            prefix is the package Standard.

Diff:
---
 gcc/ada/sem_ch4.adb | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb
index 5b9456bed0a5..406983995f3d 100644
--- a/gcc/ada/sem_ch4.adb
+++ b/gcc/ada/sem_ch4.adb
@@ -6619,18 +6619,20 @@ package body Sem_Ch4 is
       ------------------
 
       function Has_Fixed_Op (Typ : Entity_Id; Op : Entity_Id) return Boolean is
-         Bas : constant Entity_Id := Base_Type (Typ);
+         Bas    : constant Entity_Id := Base_Type (Typ);
+         Orig_N : constant Node_Id   := Original_Node (N);
+
          Ent : Entity_Id;
          F1  : Entity_Id;
          F2  : Entity_Id;
 
       begin
-         --  If the universal_fixed operation is given explicitly the rule
+         --  If the universal_fixed operation is given explicitly, the rule
          --  concerning primitive operations of the type do not apply.
 
-         if Nkind (N) = N_Function_Call
-           and then Nkind (Name (N)) = N_Expanded_Name
-           and then Entity (Prefix (Name (N))) = Standard_Standard
+         if Nkind (Orig_N) = N_Function_Call
+           and then Nkind (Name (Orig_N)) = N_Expanded_Name
+           and then Entity (Prefix (Name (Orig_N))) = Standard_Standard
          then
             return False;
          end if;

Reply via email to