From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from rock.gnat.com (rock.gnat.com [IPv6:2620:20:4000:0:a9e:1ff:fe9b:1d1]) by sourceware.org (Postfix) with ESMTP id 737C0397283D for ; Tue, 4 May 2021 09:52:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 737C0397283D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=derodat@adacore.com Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 10C6E5613C; Tue, 4 May 2021 05:52:23 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at gnat.com Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id aFNPhqmA-8Hs; Tue, 4 May 2021 05:52:23 -0400 (EDT) Received: from tron.gnat.com (tron.gnat.com [205.232.38.10]) by rock.gnat.com (Postfix) with ESMTP id E8CCF56134; Tue, 4 May 2021 05:52:22 -0400 (EDT) Received: by tron.gnat.com (Postfix, from userid 4862) id E82CB16E; Tue, 4 May 2021 05:52:22 -0400 (EDT) Date: Tue, 4 May 2021 05:52:22 -0400 From: Pierre-Marie de Rodat To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [Ada] Fix inconsistent iteration with First_Formal and Next_Entity Message-ID: <20210504095222.GA90494@adacore.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="9jxsPFA5p3P2qPhR" Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Tue, 04 May 2021 09:52:27 -0000 --9jxsPFA5p3P2qPhR Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Iteration routines should come in pairs, i.e. First_Formal with Next_Formal and First_Entity with Next_Entity. This patch fixes two occurrences where First_Formal was used with Next_Entity. Cleanup only; semantics is unaffected. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_ch12.adb (Check_Abstract_Primitives): Match First_Formal with Next_Formal. * sem_ch6.adb (Is_Non_Overriding_Operation): Likewise. --9jxsPFA5p3P2qPhR Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="patch.diff" diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb --- a/gcc/ada/sem_ch12.adb +++ b/gcc/ada/sem_ch12.adb @@ -13682,8 +13682,8 @@ package body Sem_Ch12 is exit; end if; - Next_Entity (Anc_Formal); - Next_Entity (Act_Formal); + Next_Formal (Anc_Formal); + Next_Formal (Act_Formal); end loop; -- If we traversed through all of the formals diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -10713,8 +10713,8 @@ package body Sem_Ch6 is exit; end if; - Next_Entity (P_Formal); - Next_Entity (N_Formal); + Next_Formal (P_Formal); + Next_Formal (N_Formal); end loop; -- Found a matching primitive operation belonging to the --9jxsPFA5p3P2qPhR--