From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by sourceware.org (Postfix) with ESMTPS id 199583857701 for ; Thu, 15 Jun 2023 08:04:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 199583857701 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-4f655293a38so9688593e87.0 for ; Thu, 15 Jun 2023 01:04:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1686816245; x=1689408245; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=qtziNojN9igMpGxDVEEdyaZEkDDavulj/zN/ODdHO4g=; b=WYT7n59iGCxe7f9ut+jWCEux14Ju5az4aMteJjQWgrEyJEw+oNWBg+Fh0CfSnatmJq 1LWg6EIZO7u1ezsdQl0bRiQa7opqA6VUEsKt5I1+Gi/1QY4S6o0j3h/SfY+RLYqTZzqe CAWQ5Ixq/npZYpZD/qcQAG7EXE/YCJqz/HSn6flD0T2UMonvZ732kwfvDaoItRmV5jeR 3u79XTF41WYC9Mtmq6EE7CLqJDkbqyjg77r7qFCziaDczLTLnGA4wVzk9tdfN3HmGkar nwA7JnhxeanrZV+tUtQD7/ZGkEHEVYPXt9PEXmfiNL5re6AU22yRmtsfvCVULmqpVHyY LEvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686816245; x=1689408245; 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=qtziNojN9igMpGxDVEEdyaZEkDDavulj/zN/ODdHO4g=; b=Uk/0tQfkYPhgKo+U4pvUZZxqhhucpUOB+af3ZxjxNuebCwScTsoD6OWtdXeRg4Qd6d Pnsg01GOSYlHgThZ6f2ZVESqUwULdmHQHa1x1PdBhJstOoNsQqrJT2PQDdnC5hJ7QFaJ bXlCGJ0Sz0T9OvJTF+Lo4iNhCfgksp3LMr/M2YatwfwAl8WEDgrQ66MnqfTagv7OQXsU eP/Q90z9MUB8RKhRP+3v9rDJN+Lm+pEj/JaFsS/+uqwRcPdoJ/EEx0FDeHeC/ZuFbpKU SQZeTgK4TzV8pADH2dgODLPa7maedKoDKZP/JSmxRWLnF8MdNloWa7uwh5LNpafT/hda OCXQ== X-Gm-Message-State: AC+VfDxMANgQKhMwzPKFxMm8Jey6J3fH0F7N9675aM3tAjKkFw8xA4Wu GHVmKOcUCTxrTMBxIsZifaoIz4MqGncw2JXEtrEi0A== X-Google-Smtp-Source: ACHHUZ50v59ibKSGAwRAq37e70iDsetkR+5gyge+oePs19svRm1u59iFLXVj92V0FPkfWF+29K0l1Q== X-Received: by 2002:a19:505e:0:b0:4f7:66fd:a331 with SMTP id z30-20020a19505e000000b004f766fda331mr2319326lfj.64.1686816245762; Thu, 15 Jun 2023 01:04:05 -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 f25-20020a7bcd19000000b003f7ff520a14sm19609907wmj.22.2023.06.15.01.04.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Jun 2023 01:04:05 -0700 (PDT) From: =?UTF-8?q?Marc=20Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [COMMITTED] ada: Fix missing error on function call returning incomplete view Date: Thu, 15 Jun 2023 10:04:04 +0200 Message-Id: <20230615080404.939261-1-poulhies@adacore.com> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 List-Id: From: Eric Botcazou Testing for the presence of Non_Limited_View is not sufficient to detect whether the nonlimited view has been analyzed because Build_Limited_Views always sets the field on the limited view. Instead the discriminant is whether this nonlimited view is itself an incomplete type. gcc/ada/ * sem_ch4.adb (Analyze_Call): Adjust the test to detect the presence of an incomplete view of a type on a function call. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_ch4.adb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb index 02c59284994..b4b158a3ff4 100644 --- a/gcc/ada/sem_ch4.adb +++ b/gcc/ada/sem_ch4.adb @@ -1540,8 +1540,14 @@ package body Sem_Ch4 is Set_Etype (N, Full_View (Etype (N))); + -- If the call is within a thunk, the nonlimited view should be + -- analyzed eventually (see also Analyze_Return_Type). + elsif From_Limited_With (Etype (N)) and then Present (Non_Limited_View (Etype (N))) + and then + (Ekind (Non_Limited_View (Etype (N))) /= E_Incomplete_Type + or else Is_Thunk (Current_Scope)) then Set_Etype (N, Non_Limited_View (Etype (N))); -- 2.40.0