[gcc r13-7872] ada: Fix small fallout of previous change
Eric Botcazou
ebotcazou@gcc.gnu.org
Wed Sep 27 08:25:37 GMT 2023
https://gcc.gnu.org/g:5cc6e7886b7f6cf31e25257268eec3336433fd5f
commit r13-7872-g5cc6e7886b7f6cf31e25257268eec3336433fd5f
Author: Eric Botcazou <ebotcazou@adacore.com>
Date: Wed Apr 5 23:53:18 2023 +0200
ada: Fix small fallout of previous change
It may lead to an infinite recursion if no interpretation exists.
gcc/ada/
* sem_res.adb (Try_User_Defined_Literal): Restrict previous change
to non-leaf nodes.
Diff:
---
gcc/ada/sem_res.adb | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
index 615d9d81a84..4d0c1b4b17e 100644
--- a/gcc/ada/sem_res.adb
+++ b/gcc/ada/sem_res.adb
@@ -13219,15 +13219,17 @@ package body Sem_Res is
-- Both operands must have the same type as the context
-- (ignoring for now fixed-point and exponentiation ops).
- if Covers (Typ, Etype (Right_Opnd (N)))
- or else Has_Applicable_User_Defined_Literal (Right_Opnd (N), Typ)
+ if Has_Applicable_User_Defined_Literal (Right_Opnd (N), Typ)
+ or else (Nkind (Left_Opnd (N)) in N_Op
+ and then Covers (Typ, Etype (Right_Opnd (N))))
then
Resolve (Left_Opnd (N), Typ);
Analyze_And_Resolve (N, Typ);
return True;
- elsif Covers (Typ, Etype (Left_Opnd (N)))
- or else Has_Applicable_User_Defined_Literal (Left_Opnd (N), Typ)
+ elsif Has_Applicable_User_Defined_Literal (Left_Opnd (N), Typ)
+ or else (Nkind (Right_Opnd (N)) in N_Op
+ and then Covers (Typ, Etype (Left_Opnd (N))))
then
Resolve (Right_Opnd (N), Typ);
Analyze_And_Resolve (N, Typ);
More information about the Gcc-cvs
mailing list