Message ID | 20240610090747.1557638-13-poulhies@adacore.com |
---|---|
State | New |
Headers | show
Return-Path: <gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=MzynjSX0; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VyR225qd4z20Tk for <incoming@patchwork.ozlabs.org>; Mon, 10 Jun 2024 19:14:01 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 931A1385DDCE for <incoming@patchwork.ozlabs.org>; Mon, 10 Jun 2024 09:13:59 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) by sourceware.org (Postfix) with ESMTPS id 49DAE3857340 for <gcc-patches@gcc.gnu.org>; Mon, 10 Jun 2024 09:08:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 49DAE3857340 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 49DAE3857340 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::631 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718010497; cv=none; b=nUCJFZ6yWiCjsPL5KKyzFfYp5Zksx565dD+cohL8B7eb9ipfK5ekaqwZGygLy8iRyS6s2Aoy+Wh9wJmglljssn8ItAzWixZJgfr1IwXyqlEynH31e0dTCxO53+C0e54lG/YL3oYCYyKmKIoxa/OyH/Z7KIQLaGq360wOoSOcVos= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718010497; c=relaxed/simple; bh=+QlhhDH1aPu4EegfWcspoP8x8pVzjkzVQQsRgiKa49Y=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=NrjFDlAclDazR1/zKiXJmzXxRI58/59mvj7YOpGK0/7Nj2GNzVHU6ogv5PLo1oGUVCfYyxThy3d/+Yzs+IAl9fKuOXVERNFlEUEojUBwgAsSaokhb3LhJuDqllwsE/d0ePcAyvOJeTzFDsAQSBh3onIX3KpTtqi4wCaGKlmOWBk= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-a6ef8e62935so243548266b.3 for <gcc-patches@gcc.gnu.org>; Mon, 10 Jun 2024 02:08:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1718010492; x=1718615292; 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=8+GIpvXOuXz9iqH7ItNlh+738cMFqSmtCBKynXPzhr0=; b=MzynjSX0rrkDQ5M1bgCWpZtsgVe1Td4L8nYV9a5g/NSga1qzNGE0ocwHRgs5aoZpQK fz+IkSw8xBt/WieXLiHlhefY6h4RcGmxX0nYdMUbzswzmteIt2dOpiqn1v+SIkZARhmH HHF9tC3BCEEFfbne/qMdgqgYnGiozcx0Fw2KtkAuNGzChIErUPs0OVROCJ3aOMYqnJlu d6bmS7Jwp2XblSLqLR3NMGv1eFZtHcM5DreVjVNayMIbMYZMusIbpP5v49hB3ASHgTSj +qE2sTC4iOV97nSsO6A4aLmMl+2eZObsdmMThZRep47Xw18KdhkJjtLtZfpMy/WW188b hS5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718010492; x=1718615292; 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=8+GIpvXOuXz9iqH7ItNlh+738cMFqSmtCBKynXPzhr0=; b=kqYhpqChPSOELKpoOo4P61GpOT6CZlY/YrF2/h4K8fT2G/xOgxKjI0SoPcz0rvnPYy AzKFZx5hUGk7y31jC2H15oKy4jz9LQbOQRVu3Ip2ySMbT+MVkFUPHgicF4QVhI7h+5Ib 2RX/DExtpi0jenJ19y/+wO2DSnxb9HQanJMIjlHT+LhgYKi79920raIj1bG0NkSVyhje bnexWfLrxp2XGXgeIvlgicYgUxkBISV1piIs/+9/IIdyJH8qpviB5kTDwMJSgYEk6QDX xEWln4qhJLD+IyC7TEuDmOs2ZgiXkGjApb3vP+VbtmfsPOzYXcchERNu5VOW+WP2Qjbn 8hVg== X-Gm-Message-State: AOJu0YwDyrHvFE5Kfb1Rp5ipK6WrH4I53JGaT2QhcqESxdiyvCmtxDM8 t5+TVfpecxkKyDcG5XpoZcXqLM6oUdQkW6GkEdFrO+UnQxS0VkwLkDSG5O6yegEGmcPdqVc3/3k = X-Google-Smtp-Source: AGHT+IF4NxQAeIQmC51ZEKQ4PDcniczB7T0BsY4L72EdW4NT/dxxVGuzvo0VXD3EyDObkzs7drhHfg== X-Received: by 2002:a17:907:318c:b0:a6e:d339:c09c with SMTP id a640c23a62f3a-a6ed339c322mr772827566b.48.1718010492013; Mon, 10 Jun 2024 02:08:12 -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 ffacd0b85a97d-35f0f551c20sm6454970f8f.69.2024.06.10.02.08.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 02:08:11 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= <poulhies@adacore.com> To: gcc-patches@gcc.gnu.org Cc: Ronan Desplanques <desplanques@adacore.com> Subject: [COMMITTED 13/30] ada: Fix incorrect lower bound presumption in gnatlink Date: Mon, 10 Jun 2024 11:07:29 +0200 Message-ID: <20240610090747.1557638-13-poulhies@adacore.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240610090747.1557638-1-poulhies@adacore.com> References: <20240610090747.1557638-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, 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.30 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org |
Series |
[COMMITTED,01/30] ada: Refactor checks for Refined_Global in generic instances
|
expand
|
diff --git a/gcc/ada/gnatlink.adb b/gcc/ada/gnatlink.adb index d00fd9e5af7..1455412ef93 100644 --- a/gcc/ada/gnatlink.adb +++ b/gcc/ada/gnatlink.adb @@ -42,6 +42,7 @@ with Types; with Ada.Command_Line; use Ada.Command_Line; with Ada.Exceptions; use Ada.Exceptions; +with Ada.Strings.Fixed; with System.OS_Lib; use System.OS_Lib; with System.CRTL; @@ -1697,15 +1698,13 @@ begin procedure Check_File_Name (S : String) is begin - for J in 1 .. FN'Length - (S'Length - 1) loop - if FN (J .. J + (S'Length - 1)) = S then - Error_Msg - ("warning: executable file name """ & Output_File_Name.all - & """ contains substring """ & S & '"'); - Error_Msg - ("admin privileges may be required to run this file"); - end if; - end loop; + if Ada.Strings.Fixed.Index (FN, S) /= 0 then + Error_Msg + ("warning: executable file name """ & Output_File_Name.all + & """ contains substring """ & S & '"'); + Error_Msg + ("admin privileges may be required to run this file"); + end if; end Check_File_Name; -- Start of processing for Bad_File_Names_On_Windows
From: Ronan Desplanques <desplanques@adacore.com> This patch fixes a subprogram in gnatlink that incorrectly assumed that the strings it is passed as arguments all have a lower bound of 1. gcc/ada/ * gnatlink.adb (Check_File_Name): Fix incorrect assumption. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/gnatlink.adb | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)