public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-7872] ada: Fix small fallout of previous change
@ 2023-09-27 8:25 Eric Botcazou
0 siblings, 0 replies; only message in thread
From: Eric Botcazou @ 2023-09-27 8:25 UTC (permalink / raw)
To: gcc-cvs
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);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-09-27 8:25 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-27 8:25 [gcc r13-7872] ada: Fix small fallout of previous change Eric Botcazou
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).