From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by sourceware.org (Postfix) with ESMTPS id 56D423898392 for ; Fri, 21 Jun 2024 08:58:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 56D423898392 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 56D423898392 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::12e ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718960328; cv=none; b=YTLvrex0iN64akaFvpRXgXP+bYs8t13FQLobs//Q2gAFmQv2gWmyuB3VX5fymZVIoLFpyZjoQFNguGiMk0MzJ1xQJOL2o1M3JepZYj5+zWvXK/LFdpRmwgZcZUxtp2F4MrWOLN9iavPEdJqGrzY3/9TyHi5ix6GBvmyYzaOiEzU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718960328; c=relaxed/simple; bh=5j0Ez1PZeh1u5wnybs/91Uf5YqShxf+7+35LXwD/5g4=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=VKn3xCfeBLdVwAvYTbm+3xt0u2GJsZVpCxfDa/C7Hk+uR/2BjzAZoImdewkAQXobFiH9vH2UxMxJ1jUQuPrQ7EX0ARDTBlNd3l+Hw2qfob7Bnhkj/tLP1GYHqrNo5mFm4BcyxrPEtp38vTh+Giry+RbIqHHW+XmJCGlRgPYcsXg= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-52ccc40e72eso1381061e87.3 for ; Fri, 21 Jun 2024 01:58:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1718960322; x=1719565122; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=lQBZUcxBTMu4e5kytvnjvv9Jb3a0hcQNrk3RP7I+Vlc=; b=d+PcvfeMUM5tb9T36tK31yMzTJx7KnBDmlqEisz5m3aQ8Z2wPeMVoJLwpSfiZfmN2l Nlz71qvr66AbvTDGowH6u9f4dZHS8IKuGnjJGhBJNv1Kulxw+nG1yXYGRVxrz/V1hdgn ma1AcXrAtwCTldHIpRK/JNcRjFc/I/wK86HcrU8nROqXVZBI6FdYplZ61C9YwJIXcKiB 2E2XhcKtLoujp57mfmVGDlIkWXhHqzPA62YIlOVARWopdoCDXsv/+pFDPTtOz8A/tfzc 8CV7f4wIH6PyX4V1JpiPj1yHMF14XLjDMyresVmrrTn+AW/Q704hD2Kx4cr7ztiHrJLC 6jfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718960322; x=1719565122; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lQBZUcxBTMu4e5kytvnjvv9Jb3a0hcQNrk3RP7I+Vlc=; b=SQYV0I+S8OAjYWtrdKno5BZ8e2BIL3w9CoHPbvZqHEw3Zn9oeE5CiwpYUQXpbxYdPq zWon5tHiWU5CbVOTxou8Y6hFao573fx6niGliW7+slYr/L9N705GUYv3tnFt47V2arVc LUiH3Fb7Vb8oALC47/dlZh45dSJyO9EgSukpAX4tu11VicTCnH3G6Vd8glzLOHNZnvIx Y9y5NyGDC0IYnLLa5CXi3ExLbqMFoerLIVGyiIrandO0qR95LxsvMEvrodAtUItAvhhZ 6hIMMwYb4mGTnJCuVMmw/7E09ZyHvzRJztwZYWuGtp078g9yWTtoos86nrh3BqBjShCR PX9g== X-Gm-Message-State: AOJu0Ywd40Rli2z5K82hAKouPY/xle5+cVWZSSvW5KdZGXWOajyMxQrQ pw9E5OaUIhPRVPF1+hGLjxxi4Va+5kQmDClhhaA7YxgZv5ApQCAk8IewTr/+a552nlIXlUimKKs = X-Google-Smtp-Source: AGHT+IEAiM7S+nnY3d9ZaliX9BH40mC8WdgnDNa3jgd4PDQoCAwONSitdUezQQHNRjLVWYxq+zXJFQ== X-Received: by 2002:a05:6512:3195:b0:52c:898b:a180 with SMTP id 2adb3069b0e04-52ccaa2c7c9mr7181413e87.12.1718960321743; Fri, 21 Jun 2024 01:58:41 -0700 (PDT) Received: from poulhies-Precision-5550.lan ([2001:861:3382:1a90:a589:2704:bfe1:5d92]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4247d0c5485sm55322375e9.21.2024.06.21.01.58.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jun 2024 01:58:41 -0700 (PDT) From: =?UTF-8?q?Marc=20Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [COMMITTED 15/22] ada: Fix crash in GNATbind during error reporting Date: Fri, 21 Jun 2024 10:58:11 +0200 Message-ID: <20240621085819.2485987-15-poulhies@adacore.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240621085819.2485987-1-poulhies@adacore.com> References: <20240621085819.2485987-1-poulhies@adacore.com> 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 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 This is the minimal fix to avoid the crash. gcc/ada/ * bcheck.adb (Check_Consistency_Of_Sdep): Guard against path to ALI file not found. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/bcheck.adb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/gcc/ada/bcheck.adb b/gcc/ada/bcheck.adb index 56a417cc517..64a6734a330 100644 --- a/gcc/ada/bcheck.adb +++ b/gcc/ada/bcheck.adb @@ -162,10 +162,14 @@ package body Bcheck is end if; else - ALI_Path_Id := - Osint.Full_Lib_File_Name (A.Afile); + ALI_Path_Id := Osint.Full_Lib_File_Name (A.Afile); + + -- Guard against Find_File not finding (again) the file because + -- Primary_Directory has been clobbered in between. - if Osint.Is_Readonly_Library (ALI_Path_Id) then + if Present (ALI_Path_Id) + and then Osint.Is_Readonly_Library (ALI_Path_Id) + then if Tolerate_Consistency_Errors then Error_Msg ("?{ should be recompiled"); Error_Msg_File_1 := ALI_Path_Id; -- 2.45.1