From patchwork Tue Nov 9 09:46:12 2021 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: 47260 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 95608385843D for ; Tue, 9 Nov 2021 10:04:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 95608385843D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1636452287; bh=6INDyP1m7wWHbA4Ovz9nhVUII+7+KCVyNGt+8lIDIyM=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=ffwaionfDsFU6U4+WRVjejfTLREqYHQvQUqpRxJBhJzpQkct0+LxRs8tseR86e1um /gDZmIPyybuoFIPvyubAW+Se6+hW909f7e4DAfEzhPnJ7/6nZcUtPvJ8Nz61ZB9ov1 ZzsZp8X8Ke9+qWHY/Jf2D+krvrWK+bCNXug47jek= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com [IPv6:2a00:1450:4864:20::22a]) by sourceware.org (Postfix) with ESMTPS id 7000B385843D for ; Tue, 9 Nov 2021 09:46:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7000B385843D Received: by mail-lj1-x22a.google.com with SMTP id e11so15890528ljo.13 for ; Tue, 09 Nov 2021 01:46:15 -0800 (PST) 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=6INDyP1m7wWHbA4Ovz9nhVUII+7+KCVyNGt+8lIDIyM=; b=VVCDUZ6C4M301OpfvI4RjPbrWopK2RzjHOJM3LffBWVVhK13/JJ56X9biiBgMLDucv pitZoW5ZR+TJwvHKWIsesupBs9AuE3TRawDCR0ME95aRXCmhklpEZAnxCTvp3OBsteEy HnyB8nkQ929b1Zkf+u2rsm6+nlc9nVlCBCoKC/eN2dy55mhUK3Xs1TIhzvLCdMLRU0v0 Uz9q+JjzboUB252xBJ58ypZvmdN2/yJqh78q211/d8n88eKqADG/U796TEIDRA+f/yGy CIK1xowoFE+pkbS2N48mKBp6+PnkcS72WWNkjSIbVgjVDuln7rPc3Fy1Pb6n9dy61nLs vBrA== X-Gm-Message-State: AOAM531K4MhVqPD3/IXHFCA3MRGrQgibkrR6t6BioxjDA5IahPB8tSHd hsOOi2RPUL/0JCwfG8gY9xKaTyQwusSVfCcP X-Google-Smtp-Source: ABdhPJw9Yva8OkO5s5UjWEMy/IrrUOK+nmWGgX8epQOx0YxNNH6QwhQiO3uAJ4X2F+yAKy21Sfet3g== X-Received: by 2002:a2e:9994:: with SMTP id w20mr6216874lji.64.1636451174333; Tue, 09 Nov 2021 01:46:14 -0800 (PST) Received: from adacore.com ([2a02:2ab8:224:2ce:72b5:e8ff:feef:ee60]) by smtp.gmail.com with ESMTPSA id w6sm2095795lfk.242.2021.11.09.01.46.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Nov 2021 01:46:13 -0800 (PST) Date: Tue, 9 Nov 2021 09:46:12 +0000 To: gcc-patches@gcc.gnu.org Subject: [Ada] Initialize Current_Source_Unit Message-ID: <20211109094612.GA830765@adacore.com> MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-13.0 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.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Etienne Servais Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Preprocessing may call Error_Msg though Current_Source_Unit is not initialized. When gnat1 is compiled with gnatVa, this leads to a Constraint_Error. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sinput.ads: Initialize Current_Source_Unit to No_Unit. diff --git a/gcc/ada/sinput.ads b/gcc/ada/sinput.ads --- a/gcc/ada/sinput.ads +++ b/gcc/ada/sinput.ads @@ -412,10 +412,10 @@ package Sinput is -- Initialized so that some tools (such as gprbuild) can be built with -- -gnatVa and pragma Initialize_Scalars without problems. - Current_Source_Unit : Unit_Number_Type; - -- Unit number of source file currently being scanned. The special value - -- of No_Unit indicates that the configuration pragma file is currently - -- being scanned (this has no entry in the unit table). + Current_Source_Unit : Unit_Number_Type := No_Unit; + -- Unit number of source file currently being scanned. Initialized to + -- No_Unit for pre-processing and the configuration pragma file scanning, + -- since both stages have no corresponding entry in the unit table. Source_gnat_adc : Source_File_Index := No_Source_File; -- This is set if a gnat.adc file is present to reference this file