From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x634.google.com (mail-ej1-x634.google.com [IPv6:2a00:1450:4864:20::634]) by sourceware.org (Postfix) with ESMTPS id CCA9B3838E68 for ; Thu, 2 Jun 2022 09:08:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CCA9B3838E68 Received: by mail-ej1-x634.google.com with SMTP id n10so8721772ejk.5 for ; Thu, 02 Jun 2022 02:08:47 -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=TABE4jWIO4FIYlnr+IjdrxSxwuxP2Wi2f1qQnfxoFSI=; b=1521YiKhiQCm05svQueNtcvXtxCbZLrsuy98F/WPFmU3q4x75XsAmsvyyico5TtvwB xz1qyIXhdHtQKY7FnUH7JaQ5OTlEEB/LL+l4vYGU/FMZzwHKjEuZKqp52b7gg19HKR5i bYckWNS+sWH9IIjZUeTThkpc2vww2PcH6iDZU3IKOtrpZlls756oCRB1Cjc+zZEeeEts Aa08qF/S0fc0gCLNzDaKp3uXM1QLo9gnNtYo42JmLigp3ZQi88OgsmbFIdA3C+0cNNQh x82FRrtlwK8BvMP3/NvP5cVt4hTi4rumx5CzIeHmCdYR8HtW/pqBQDmWKJFApC/Nv+FD OX+Q== X-Gm-Message-State: AOAM531f2Ex8JaiIE7JPE/4c31HVFtD01gB+q95gLt5bti1Cn3HK97HT Nud7M070zhgGeBXWHMISRG9+f/no4F8rlQ== X-Google-Smtp-Source: ABdhPJwwcTlKPtWIwaTxSFd8qE+t1tbdX9P7h7MKQq3aAq77k2U60ogZTso9ckv0BtDX6EbyVqJu5g== X-Received: by 2002:a17:906:9751:b0:6fe:ed24:ef48 with SMTP id o17-20020a170906975100b006feed24ef48mr3219827ejy.414.1654160926640; Thu, 02 Jun 2022 02:08:46 -0700 (PDT) Received: from adacore.com ([45.147.211.82]) by smtp.gmail.com with ESMTPSA id iy18-20020a170907819200b006fec9cf9237sm589708ejc.130.2022.06.02.02.08.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jun 2022 02:08:46 -0700 (PDT) Date: Thu, 2 Jun 2022 09:08:45 +0000 From: Pierre-Marie de Rodat To: gcc-patches@gcc.gnu.org Cc: Claire Dross Subject: [Ada] Fix iteration on formal vectors Message-ID: <20220602090845.GA1010495@adacore.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="azLHFNyN32YCQGCU" 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-List-Received-Date: Thu, 02 Jun 2022 09:08:49 -0000 --azLHFNyN32YCQGCU Content-Type: text/plain; charset=us-ascii Content-Disposition: inline We need to use Extended_Index for the Position parameter of the Element function in formal vectors so it is compatible with other primitives of the Iterable aspect. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * libgnat/a-cfinve.ads (Element): Change the type of the Position parameter to Extended_Index. * libgnat/a-cfinve.adb (Element): Idem. * libgnat/a-cofove.ads (Element): Idem. * libgnat/a-cofove.adb (Element): Idem. --azLHFNyN32YCQGCU Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="patch.diff" diff --git a/gcc/ada/libgnat/a-cfinve.adb b/gcc/ada/libgnat/a-cfinve.adb --- a/gcc/ada/libgnat/a-cfinve.adb +++ b/gcc/ada/libgnat/a-cfinve.adb @@ -432,7 +432,7 @@ is function Element (Container : Vector; - Index : Index_Type) return Element_Type + Index : Extended_Index) return Element_Type is begin if Index > Container.Last then diff --git a/gcc/ada/libgnat/a-cfinve.ads b/gcc/ada/libgnat/a-cfinve.ads --- a/gcc/ada/libgnat/a-cfinve.ads +++ b/gcc/ada/libgnat/a-cfinve.ads @@ -284,7 +284,7 @@ is function Element (Container : Vector; - Index : Index_Type) return Element_Type + Index : Extended_Index) return Element_Type with Global => null, Pre => Index in First_Index (Container) .. Last_Index (Container), diff --git a/gcc/ada/libgnat/a-cofove.adb b/gcc/ada/libgnat/a-cofove.adb --- a/gcc/ada/libgnat/a-cofove.adb +++ b/gcc/ada/libgnat/a-cofove.adb @@ -370,7 +370,7 @@ is function Element (Container : Vector; - Index : Index_Type) return Element_Type + Index : Extended_Index) return Element_Type is begin if Index > Container.Last then diff --git a/gcc/ada/libgnat/a-cofove.ads b/gcc/ada/libgnat/a-cofove.ads --- a/gcc/ada/libgnat/a-cofove.ads +++ b/gcc/ada/libgnat/a-cofove.ads @@ -263,7 +263,7 @@ is function Element (Container : Vector; - Index : Index_Type) return Element_Type + Index : Extended_Index) return Element_Type with Global => null, Pre => Index in First_Index (Container) .. Last_Index (Container), --azLHFNyN32YCQGCU--