From patchwork Thu Jun 2 09:08:46 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: 1638260 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=vVOGm21P; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LDKyq1kySz9s0w for ; Thu, 2 Jun 2022 19:12:03 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 48BEB3954C40 for ; Thu, 2 Jun 2022 09:12:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 48BEB3954C40 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1654161121; bh=iV55UtXSt7WEG2FBOj++7qmY880i3axL8Sm7gZyAAhM=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=vVOGm21PvmIM+yErKGajBc6GhX50F0yGrMlomMSx5uj9F1qJ6DvNcdOngo5CsAL1D GzidX1CazExZy6exc3TA1JV0Y42QAUO0gpc9fmFRo3XTfduj0pW4edwsJcvdwEDxs/ N0kQlhQlvZnPSUxzFGfw7Fk/mCB3XV2WzgmPtgTw= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by sourceware.org (Postfix) with ESMTPS id 233B2395443E for ; Thu, 2 Jun 2022 09:08:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 233B2395443E Received: by mail-ej1-x62f.google.com with SMTP id fu3so7223720ejc.7 for ; Thu, 02 Jun 2022 02:08:49 -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=iV55UtXSt7WEG2FBOj++7qmY880i3axL8Sm7gZyAAhM=; b=DeBVWLicvgaGQyFIuCKbdrpb0/RUM3jHNkIiLitF85CJsc19ijIfpdDjklRYTdTadg 5u2fKyAE4khgwohfPwj1JadUd9Ro1yOqcQhL/a98GnaQQ15DbhBC5neyi9iad8zyQ2n0 BaJUxr8xmAnE3ChQinqQhheY1Yyw/N45uhswTQp/PRoOWcXpitq/lzX0HWz1EUooEv7L qhXCtCjZYFclnyMPMOvnWemGiBZOuz8tP1A9WhCSLvNYVlv5ae32Rlw0i0UmHrJmRIdc 18j6ezukIpazs6mLA/yMb3+Gc5FYq1+Mck/t+tW9uKjTYpyi/tCfDxaa4lkfwzevdgLH 3dmw== X-Gm-Message-State: AOAM5318puRiIYcrMpXD+i2knQIILNXGHOpr8GZjVlENWoFdBurXQjNg QAoA7UX/Pm2VSiMg4I2CMQgpnsLTMb3/Rg== X-Google-Smtp-Source: ABdhPJxhvmylH29bT/brzv05Do0BiGDgUsjSygj+FO5Rr27A2xvVNaHeuyTQ8DLyG2T2YZo8Lh2toQ== X-Received: by 2002:a17:907:1c1a:b0:705:3158:ab07 with SMTP id nc26-20020a1709071c1a00b007053158ab07mr3260660ejc.767.1654160927927; Thu, 02 Jun 2022 02:08:47 -0700 (PDT) Received: from adacore.com ([45.147.211.82]) by smtp.gmail.com with ESMTPSA id g3-20020aa7dd83000000b0042bc5a536edsm2172896edv.28.2022.06.02.02.08.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jun 2022 02:08:47 -0700 (PDT) Date: Thu, 2 Jun 2022 09:08:46 +0000 To: gcc-patches@gcc.gnu.org Subject: [Ada] Gnatbind crash during checksum calculation Message-ID: <20220602090846.GA1010514@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: Justin Squirek Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" This patch corrects an error in the compiler whereby gnatbind may crash during calculation of file checksums in certain corner cases due to uninitialized lookup tables. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * gnatbind.adb (Gnatbind): Add initialize call for Uintp * gnatls.adb (Gnatls): Likewise. * gprep.adb (Gnatprep): Likewise. * make.adb (Initialize): Likewise. diff --git a/gcc/ada/gnatbind.adb b/gcc/ada/gnatbind.adb --- a/gcc/ada/gnatbind.adb +++ b/gcc/ada/gnatbind.adb @@ -50,6 +50,7 @@ with Switch; use Switch; with Switch.B; use Switch.B; with Targparm; use Targparm; with Types; use Types; +with Uintp; with System.Case_Util; use System.Case_Util; with System.Response_File; @@ -617,6 +618,7 @@ begin -- is in some cases important. Csets.Initialize; + Uintp.Initialize; Snames.Initialize; -- Scan the switches and arguments. Note that Snames must already be diff --git a/gcc/ada/gnatls.adb b/gcc/ada/gnatls.adb --- a/gcc/ada/gnatls.adb +++ b/gcc/ada/gnatls.adb @@ -44,6 +44,7 @@ with Snames; with Stringt; with Switch; use Switch; with Types; use Types; +with Uintp; with GNAT.Case_Util; use GNAT.Case_Util; with GNAT.Command_Line; use GNAT.Command_Line; @@ -2023,6 +2024,7 @@ begin -- Initialize standard packages Csets.Initialize; + Uintp.Initialize; Snames.Initialize; Stringt.Initialize; diff --git a/gcc/ada/gprep.adb b/gcc/ada/gprep.adb --- a/gcc/ada/gprep.adb +++ b/gcc/ada/gprep.adb @@ -37,6 +37,7 @@ with Snames; with Stringt; use Stringt; with Switch; use Switch; with Types; use Types; +with Uintp; with Ada.Command_Line; use Ada.Command_Line; with Ada.Text_IO; use Ada.Text_IO; @@ -169,6 +170,7 @@ package body GPrep is -- Do some initializations (order is important here) Csets.Initialize; + Uintp.Initialize; Snames.Initialize; Stringt.Initialize; Prep.Initialize; diff --git a/gcc/ada/make.adb b/gcc/ada/make.adb --- a/gcc/ada/make.adb +++ b/gcc/ada/make.adb @@ -44,6 +44,7 @@ with SFN_Scan; with Sinput; with Snames; with Stringt; +with Uintp; pragma Warnings (Off); with System.HTable; @@ -3676,6 +3677,7 @@ package body Make is Linker_Switches.Init; Csets.Initialize; + Uintp.Initialize; Snames.Initialize; Stringt.Initialize;