From patchwork Mon May 29 08:29:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 100172 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1367580vqr; Mon, 29 May 2023 01:48:12 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4AGHBhVdNBkwqhfv6c+KkNhqvHRFlF5WsKU3ilVCayEeztkd04zWb1JOPeYH3c4gQgVGso X-Received: by 2002:a17:907:6da2:b0:971:5a79:29ff with SMTP id sb34-20020a1709076da200b009715a7929ffmr10205189ejc.48.1685350092082; Mon, 29 May 2023 01:48:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685350092; cv=none; d=google.com; s=arc-20160816; b=t8gaImE2LQf0DCQlTIOKnJgGaBnHB/7+Hhs/gzmMdi8cWUr4/ogx7h5isB4U14Ep6M 8cM8hUnlGmQQ2C//0HINTcvkIc4HeunTIErT7XU0NYYyKd4GXz3vFnRaibAApezHGVgA yqfLKpEpaP4zkgG3V05gbT8rpMo43KcZVG7X1DoMAURHwJ3yhCTRZwIFAjbntRZ48axB NijYhxiGoLh59hWGZu50kNWw0ZtHcn78w4/4/6H+wy93OaaW6FMb2LjzoYcKGidCTPIY yHsuQtRIdll5IIrezzfGkZmyaiPHJJ3MkLzJqQsW/s9S0G/0Gba6/BDAB3ac++h9HTPJ jroA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=QMPwqBNoZ26qUvsuQ+9fGbAKfE3+RgKjXQ91yhyfvfs=; b=r/Mxm2/q/OrjzOnuK1JYiWyHdwCQ1VKXLiYzRM6RX3Gf0mG385cGsm5KQSDsxeVGE8 c3CBZrXudOJ2FidT0EOxyKYi/TMw+ep1eEuBYI7L4i7dT/3ANJb/jyR1Pev5Pn5HcyEv pQHLEZTCC2qNgLcSke/VCrZK5YVE2iiY8xHGC19zB/t1PrkkZd5jGFOSVA6OuIi91Xkk TrDUdR5NpXLdmPd1utWnos9zjfb4y1r3rz5ly5FKfN3ypJdhzbHYbBJBOG6LCqTU299U SHZnvFdXJZNxEh6qE6MiNM8AatmRZx7o+4VPgrbSTgUt6EIzfKtGaO7JskSUR6cPTbSa ZcMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=SafTjmgr; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id l26-20020a170906a41a00b0097394940d6dsi7192430ejz.406.2023.05.29.01.48.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 May 2023 01:48:12 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=SafTjmgr; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4F2F2398641F for ; Mon, 29 May 2023 08:39:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4F2F2398641F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1685349578; bh=QMPwqBNoZ26qUvsuQ+9fGbAKfE3+RgKjXQ91yhyfvfs=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=SafTjmgrEJzemWwGK7JVzGj0KyfwBbY2D7JZPFR3rWNR2sXyAhUO4xqHZC5Cj/K7Y q5IP0VKvm9JRolT1NpcJFuOXn8LcCE2jnGqYGqSDAv0dBeJEFPgPrava1AskOOnULc IEYX0jgOf0YjxODAA9AFIjHxB4tg9NQaIKzz+Q+0= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by sourceware.org (Postfix) with ESMTPS id 7EAF538498F6 for ; Mon, 29 May 2023 08:29:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7EAF538498F6 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-3f603d4bc5bso31157015e9.3 for ; Mon, 29 May 2023 01:29:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685348976; x=1687940976; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=QMPwqBNoZ26qUvsuQ+9fGbAKfE3+RgKjXQ91yhyfvfs=; b=YhOTBRXDAKOaYfrgVUZiq9MR/v/l2nOmCrzP/OVAaTFAnkT/gPYLGYFPNHQ/T9b5Aq DRwlW/KKckqWWmhQvhr1NptFNNFyzXO+WgOCR66ImYN9gBzq1CUW43Lp5qCkUKhvkddd Qhmc0IF2T413tSHbq352NecXpRAtS/Rc7WNMTTOsIA86FEyIrt8kR1S2qgnqjjmS/tb+ Cbxm1jfO9dVtys2enUl616Ry4Uh722cGsvWwaLohex0tJAbCmUpT+Aw+cXM3dTd0gTmi bD+FZJ8aTEX3pgL0J7zFFSabIANRH3lMXvIRyOfeKgJPARTnhjdqbYbWyHUalu9zXDu+ w9gQ== X-Gm-Message-State: AC+VfDzEDKPEhb1tg1jadlbGOxGBz0p+/h/EsaZC70Z8rE/gssiDppwa AI3yjN5Sm3PPTg32n+4jEva/ftHWV3AR7Ke4CaETIg== X-Received: by 2002:a7b:cd85:0:b0:3f6:f56:5e82 with SMTP id y5-20020a7bcd85000000b003f60f565e82mr8595210wmj.3.1685348976248; Mon, 29 May 2023 01:29:36 -0700 (PDT) Received: from poulhies-Precision-5550.telnowedge.local (lmontsouris-659-1-24-67.w81-250.abo.wanadoo.fr. [81.250.175.67]) by smtp.gmail.com with ESMTPSA id 24-20020a05600c021800b003f080b2f9f4sm16960984wmi.27.2023.05.29.01.29.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 May 2023 01:29:35 -0700 (PDT) To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [COMMITTED] ada: Fix small fallout of previous change Date: Mon, 29 May 2023 10:29:34 +0200 Message-Id: <20230529082934.2410564-1-poulhies@adacore.com> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 X-Spam-Status: No, score=-13.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: =?utf-8?q?Marc_Poulhi=C3=A8s_via_Gcc-patches?= From: =?utf-8?q?Marc_Poulhi=C3=A8s?= Reply-To: =?utf-8?q?Marc_Poulhi=C3=A8s?= Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767217421715691522?= X-GMAIL-MSGID: =?utf-8?q?1767217657978480970?= From: Eric Botcazou 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. Tested on x86_64-pc-linux-gnu, committed on master. --- 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 17b74ea65d5..1d4b9acb8ea 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -13333,15 +13333,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);