From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 771923835428 for ; Wed, 11 May 2022 08:54:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 771923835428 Received: by mail-wr1-x42f.google.com with SMTP id q23so1977768wra.1 for ; Wed, 11 May 2022 01:54:27 -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=XIhyVYkZHHDUJPqhD1xolqF0E9R1wWkLanlwoV70MB4=; b=DsTdpSl9bZMIY8q7QBSr/JhjIqicr3jfD9ubF4uQ6b4qKM22PVCX2BBCMCVvMw40QQ HAXs5g+Ni05h8tV5fmONdjq9Dx8vGQzZFi7DKKlRvyycbTWGAfqvGchRH/Hzq9PHfO7q 4JpuvBgvAHQj5kG8svLEZ8GU3gAPwLdVTrb/Qe1Y3YDv9g3L4WQ8JXvStnjZF3/cUMdo GVQYYsXe2Ho02YGaihF3R9Gl80tLUOZaAZQjOUyOyEnS78tF1OXyJuKW27KV2ukKGTED g52Ot3x+F6401vKjZGa2gBgY3gHE/tWPcNwt2gSD1OIKEZSgVTO4AI3p4zvpTySDRIv+ 6HcQ== X-Gm-Message-State: AOAM533FFff/fVRqzx3Up+vOIRkl3f/n4vIBDQOhxgTg9RtHqbv7Fvhy 7MBCz0l4JqIHUYGTTdfXZ8tAEnK1jWRbuQ== X-Google-Smtp-Source: ABdhPJxA8Rc3ov9zCyEVfBtj+AElJuGr7niz65Ed//OU0cxqDgpcKOmp5c3pzIz/uE0Kv8Lpf+kf7w== X-Received: by 2002:a5d:5888:0:b0:20c:d66e:a637 with SMTP id n8-20020a5d5888000000b0020cd66ea637mr5917668wrf.215.1652259266228; Wed, 11 May 2022 01:54:26 -0700 (PDT) Received: from adacore.com ([45.147.211.82]) by smtp.gmail.com with ESMTPSA id f15-20020a056000128f00b0020c5253d8dbsm450573wrx.39.2022.05.11.01.54.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 May 2022 01:54:25 -0700 (PDT) Date: Wed, 11 May 2022 08:54:25 +0000 From: Pierre-Marie de Rodat To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [Ada] Add guard for making only legal labels unreachable Message-ID: <20220511085425.GA2166079@adacore.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="EVF5PPMfhYS0aIcm" 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.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-List-Received-Date: Wed, 11 May 2022 08:54:28 -0000 --EVF5PPMfhYS0aIcm Content-Type: text/plain; charset=us-ascii Content-Disposition: inline An entity flag Reachable now only applies to E_Label entities. We had an appropriate guard for setting this flag, but not for clearing. Cleanup related to detection of uninitialized scalars with GOTO statements. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_ch5.adb (Analyze_Statements): Only clear Reachable flag on proper label entities. --EVF5PPMfhYS0aIcm Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="patch.diff" diff --git a/gcc/ada/sem_ch5.adb b/gcc/ada/sem_ch5.adb --- a/gcc/ada/sem_ch5.adb +++ b/gcc/ada/sem_ch5.adb @@ -4383,7 +4383,9 @@ package body Sem_Ch5 is S := First (L); while Present (S) loop - if Nkind (S) = N_Label then + if Nkind (S) = N_Label + and then Ekind (Entity (Identifier (S))) = E_Label + then Set_Reachable (Entity (Identifier (S)), False); end if; --EVF5PPMfhYS0aIcm--