aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/ChangeLog6
-rw-r--r--gcc/ada/sem_attr.adb13
2 files changed, 16 insertions, 3 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 16653d2..db7a3d1 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,9 @@
+2025-09-30 Eric Botcazou <ebotcazou@adacore.com>
+
+ PR ada/117517
+ * sem_attr.adb (Resolve_Attribute) <Attribute_Reduce>: Try to
+ resolve the reducer first. Fix casing of error message.
+
2025-09-29 Tonu Naks <naks@adacore.com>
* doc/gnat_rm/implementation_advice.rst: PolyORB
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
index bde4d40..e9e245a 100644
--- a/gcc/ada/sem_attr.adb
+++ b/gcc/ada/sem_attr.adb
@@ -12851,7 +12851,10 @@ package body Sem_Attr is
end Proper_Op;
begin
- Resolve (Init_Value_Exp, Typ);
+ -- First try to resolve the reducer and then, if this succeeds,
+ -- resolve the initial value. This nicely deals with confused
+ -- programmers who swap the two items.
+
if Is_Overloaded (Reducer_Subp_Name) then
Outer :
for Retry in Boolean loop
@@ -12873,14 +12876,18 @@ package body Sem_Attr is
then
Op := Reducer_Subp_Name;
- elsif Proper_Op (Entity (Reducer_Subp_Name)) then
+ elsif Is_Entity_Name (Reducer_Subp_Name)
+ and then Proper_Op (Entity (Reducer_Subp_Name))
+ then
Op := Entity (Reducer_Subp_Name);
Set_Etype (N, Typ);
end if;
if No (Op) then
- Error_Msg_N ("No suitable reducer subprogram found",
+ Error_Msg_N ("no suitable reducer subprogram found",
Reducer_Subp_Name);
+ else
+ Resolve (Init_Value_Exp, Typ);
end if;
end;