aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2023-04-05 23:53:18 +0200
committerEric Botcazou <ebotcazou@adacore.com>2023-09-27 10:16:26 +0200
commit5cc6e7886b7f6cf31e25257268eec3336433fd5f (patch)
tree0ac41a8af78a00448cc0fa36c89f61f8a1db29fa /gcc
parentd051e7e75d3ad36ec62b9f53c856a7fb6dbe4f28 (diff)
downloadgcc-5cc6e7886b7f6cf31e25257268eec3336433fd5f.zip
gcc-5cc6e7886b7f6cf31e25257268eec3336433fd5f.tar.gz
gcc-5cc6e7886b7f6cf31e25257268eec3336433fd5f.tar.bz2
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.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/sem_res.adb10
1 files changed, 6 insertions, 4 deletions
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
index 615d9d8..4d0c1b4 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);