From patchwork Thu May 19 14:16:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Marie de Rodat X-Patchwork-Id: 54225 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 98CAB383802C for ; Thu, 19 May 2022 14:36:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 98CAB383802C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1652970970; bh=Ro5rcuJ/bTeH81m+l5Vaier46pJ1wMNcuNoFPB25ueY=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=S0TLS/DP/SnIulVRIDb4Vv1+Qzr8D2eN+e1+aEpUpd/jrFdZzJctUAUA2thA5Dfyv EIXP62bOqcXEsoRUfXEn/JF6qIACbQH1N7ugPwCVShU11jzunU6A0UKEdvyI0RIxzu bC/1ywQEaHHRKJC29ZmqvigUPvD3yS+k8LCvJJI4= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by sourceware.org (Postfix) with ESMTPS id CB98E383D83B for ; Thu, 19 May 2022 14:16:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CB98E383D83B Received: by mail-wr1-x42f.google.com with SMTP id k30so7382449wrd.5 for ; Thu, 19 May 2022 07:16:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=Ro5rcuJ/bTeH81m+l5Vaier46pJ1wMNcuNoFPB25ueY=; b=H/VQkYs+eusW+11Q+5Vsxnh2I+hqe76wWaOTm3y20pQMVlpBr2gAmSsqZxT7wZ1Eis cli4vWGJ0n016tl13THi5T8YZrEzl26PkXZqXHt28eEx7dsvC02gxR/RU4Ialuqc5Yzm 4NskqUYmaX7YiK+rQPn8zibUxkbGwPmMQOKe9ewdlG+p/SQyMhlwwgmuPMyQ4xRIxCrh M6IeikatPJIEtqw72cN53ti2EaCeOvqWqT03e9FPklo3ccaNGNC6xKfeoB77wENPd5rP YVeQVxKqKOucOCW0TczWwpnAnggWTVzXilXn7R6GaSCJD+8jFlIzfLDm2cg+TXGwk10l 8b4A== X-Gm-Message-State: AOAM533cIOP/TFu2Nj4xDGq0vMg8AFwvlGicoyQVUh160fiekRtb3Bvn QCh2GPDEAjWLAZIqftJbIF8McaPWpMMz2Q== X-Google-Smtp-Source: ABdhPJzlBI3jS3oj12OgOBS4CpEP3uZwUVy/Yd85BiK/QynGu6bXjRw/IJzfm9xYyAn2NaNeZXji3w== X-Received: by 2002:a5d:4b8c:0:b0:20e:5b67:c446 with SMTP id b12-20020a5d4b8c000000b0020e5b67c446mr4135277wrt.181.1652969779556; Thu, 19 May 2022 07:16:19 -0700 (PDT) Received: from adacore.com ([45.147.211.82]) by smtp.gmail.com with ESMTPSA id b5-20020a05600c4e0500b00397243d3dbcsm3226841wmq.31.2022.05.19.07.16.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 May 2022 07:16:18 -0700 (PDT) Date: Thu, 19 May 2022 14:16:18 +0000 To: gcc-patches@gcc.gnu.org Subject: [Ada] Fix continuation message without a prior error Message-ID: <20220519141618.GA3723435@adacore.com> MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-13.2 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: Pierre-Marie de Rodat via Gcc-patches From: Pierre-Marie de Rodat Reply-To: Pierre-Marie de Rodat Cc: Piotr Trojanek Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" When resolution of an expanded name fails, we call routine Error_Missing_With_Of_Known_Unit which emits an error continuation message (i.e. an error string starting with \\). However, for error continuations to work properly there must be some prior error, because continuation itself doesn't set flags like Serious_Errors_Detected. Without these flags the problematic statement is not marked with Error_Posted, which in turn is needed to prevent cascaded errors. In particular, when unresolved procedure call uses a direct name or an extended name with an unknown prefix, e.g.: Unknown (1, 2, 3); Unknown.Call (1, 2, 3); then the N_Procedure_Call statements are marked with Error_Posted. But when a call uses an extended name with a known prefix we failed to flag the N_Procedure_Call with Error_Posted. Found while improving the robustness of a feature that detects uninitialized scalar objects. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_ch8.adb (Find_Expanded_Name): Emit a main error message before adding a continuation with the call to Error_Missing_With_Of_Known_Unit. diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb --- a/gcc/ada/sem_ch8.adb +++ b/gcc/ada/sem_ch8.adb @@ -6995,6 +6995,8 @@ package body Sem_Ch8 is Standard_Standard) then if not Error_Posted (N) then + Error_Msg_NE + ("& is not a visible entity of&", Prefix (N), Selector); Error_Missing_With_Of_Known_Unit (Prefix (N)); end if;