From patchwork Tue Jul 12 12:25:12 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: 1655380 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=UMXwxRF/; 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 4Lj0Q53Dyhz9sFs for ; Tue, 12 Jul 2022 22:27:41 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0FA5238155B7 for ; Tue, 12 Jul 2022 12:27:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0FA5238155B7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1657628859; bh=LCVpzC7De0gzTENhpV6+bPj/PbvOsCV5yxGhOtWBKmo=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=UMXwxRF/leAwUyTigoQ4GhFNBu+zrk8D2W9hPGDiPh0tE1Q7a7Mv0+0ATUDI6Uwsj 6u8PZk7eOGHzBO1uEg/YuSgz13P3SEX22tlgGCN+Y8XqzOUqHl0487fRH7tfYYF1X5 /iVIBcop6XvPKnN7VXKahHpsyQtaGEX3m5pOc3pg= 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 4647C3857C76 for ; Tue, 12 Jul 2022 12:25:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4647C3857C76 Received: by mail-ej1-x62f.google.com with SMTP id os14so14017231ejb.4 for ; Tue, 12 Jul 2022 05:25:14 -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=LCVpzC7De0gzTENhpV6+bPj/PbvOsCV5yxGhOtWBKmo=; b=kP7htrXGaa0UcKDW5DAWfzvc8RepYqbgF9TxDlFxsCR9FPtcrVu+jVv/qfk3z3veuO p7ses5WLd8GD7qkujbDaScDCMLVir/JBxbpViRIl0KW0JLIZd9gqZOuHsnvC3F0bltCY 50XuGlFPYlz04rMP7B1yWWl81f4zQ0SZASMW8jNE9DO88VapN3zqW9FeJWINX+7oDhhG GcFWoSt2+c6RbN1xTMkFqXdffkNPvnlhPfMxTCxe/FT+uvDwN3PG23QHWCW49Ej1MBj+ wnM9HrMd5JKaxckYexhS0jrLE/JDS09l7vcqAq1NRDSEW4maEaLkD7IZ57BwMwOloWTH tKxg== X-Gm-Message-State: AJIora/6IULS/OF5MFjAhn+3zWhSYTtCxIQu2+gSU50guVvwECDUzHcO RoATFD4uyW/enhqXvEt/YX6tGYEMLQkkPg== X-Google-Smtp-Source: AGRyM1sZTk1ErOxQP0CIDcADee14RZlAV6ymVJWUrrqGIzajMQsEOcjDe/nvFO/ngsPc86UAVfy4Wg== X-Received: by 2002:a17:907:7628:b0:72b:4d6f:ce8a with SMTP id jy8-20020a170907762800b0072b4d6fce8amr12516115ejc.59.1657628713861; Tue, 12 Jul 2022 05:25:13 -0700 (PDT) Received: from adacore.com ([45.147.211.82]) by smtp.gmail.com with ESMTPSA id u18-20020a1709061db200b0072b85a735afsm397862ejh.113.2022.07.12.05.25.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jul 2022 05:25:13 -0700 (PDT) Date: Tue, 12 Jul 2022 12:25:12 +0000 To: gcc-patches@gcc.gnu.org Subject: [Ada] Fix buffer overrun for small string concatenation at -O0 Message-ID: <20220712122512.GA3404631@adacore.com> MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_ASCII_DIVIDERS, KAM_NUMSUBJECT, 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: Eric Botcazou Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" The concatenation routines may read too much data on the source side when the destination buffer is larger than the final result. This change makes sure that this does not happen any more and also removes obsolete stuff. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * rtsfind.ads (RE_Id): Remove RE_Str_Concat_Bounds_N values. (RE_Unit_Table): Remove RE_Str_Concat_Bounds_N entries. * libgnat/s-conca2.ads (Str_Concat_2): Adjust head comment. (Str_Concat_Bounds_2): Delete. * libgnat/s-conca2.adb (Str_Concat_2): Use the length of the last input to size the last assignment. (Str_Concat_Bounds_2): Delete. * libgnat/s-conca3.ads (Str_Concat_3): Adjust head comment. (Str_Concat_Bounds_3): Delete. * libgnat/s-conca3.adb (Str_Concat_3): Use the length of the last input to size the last assignment. (Str_Concat_Bounds_3): Delete. * libgnat/s-conca4.ads (Str_Concat_4): Adjust head comment. (Str_Concat_Bounds_4): Delete. * libgnat/s-conca4.adb (Str_Concat_4): Use the length of the last input to size the last assignment. (Str_Concat_Bounds_4): Delete. * libgnat/s-conca5.ads (Str_Concat_5): Adjust head comment. (Str_Concat_Bounds_5): Delete. * libgnat/s-conca5.adb (Str_Concat_5): Use the length of the last input to size the last assignment. (Str_Concat_Bounds_5): Delete. * libgnat/s-conca6.ads (Str_Concat_6): Adjust head comment. (Str_Concat_Bounds_6): Delete. * libgnat/s-conca6.adb (Str_Concat_6): Use the length of the last input to size the last assignment. (Str_Concat_Bounds_6): Delete. * libgnat/s-conca7.ads (Str_Concat_7): Adjust head comment. (Str_Concat_Bounds_7): Delete. * libgnat/s-conca7.adb (Str_Concat_7): Use the length of the last input to size the last assignment. (Str_Concat_Bounds_7): Delete. * libgnat/s-conca8.ads (Str_Concat_8): Adjust head comment. (Str_Concat_Bounds_8): Delete. * libgnat/s-conca8.adb (Str_Concat_8): Use the length of the last input to size the last assignment. (Str_Concat_Bounds_8): Delete. * libgnat/s-conca9.ads (Str_Concat_9): Adjust head comment. (Str_Concat_Bounds_9): Delete. * libgnat/s-conca9.adb (Str_Concat_9): Use the length of the last input to size the last assignment. (Str_Concat_Bounds_9): Delete. diff --git a/gcc/ada/libgnat/s-conca2.adb b/gcc/ada/libgnat/s-conca2.adb --- a/gcc/ada/libgnat/s-conca2.adb +++ b/gcc/ada/libgnat/s-conca2.adb @@ -46,26 +46,8 @@ package body System.Concat_2 is R (F .. L) := S1; F := L + 1; - L := R'Last; + L := F + S2'Length - 1; R (F .. L) := S2; end Str_Concat_2; - ------------------------- - -- Str_Concat_Bounds_2 -- - ------------------------- - - procedure Str_Concat_Bounds_2 - (Lo, Hi : out Natural; - S1, S2 : String) - is - begin - if S1 = "" then - Lo := S2'First; - Hi := S2'Last; - else - Lo := S1'First; - Hi := S1'Last + S2'Length; - end if; - end Str_Concat_Bounds_2; - end System.Concat_2; diff --git a/gcc/ada/libgnat/s-conca2.ads b/gcc/ada/libgnat/s-conca2.ads --- a/gcc/ada/libgnat/s-conca2.ads +++ b/gcc/ada/libgnat/s-conca2.ads @@ -36,15 +36,8 @@ package System.Concat_2 is procedure Str_Concat_2 (R : out String; S1, S2 : String); -- Performs the operation R := S1 & S2. The bounds of R are known to be - -- correct (usually set by a call to the Str_Concat_Bounds_2 procedure - -- below), so no bounds checks are required, and it is known that none of + -- sufficient so no bound checks are required, and it is known that none of -- the input operands overlaps R. No assumptions can be made about the -- lower bounds of any of the operands. - procedure Str_Concat_Bounds_2 - (Lo, Hi : out Natural; - S1, S2 : String); - -- Assigns to Lo..Hi the bounds of the result of concatenating the two - -- given strings, following the rules in the RM regarding null operands. - end System.Concat_2; diff --git a/gcc/ada/libgnat/s-conca3.adb b/gcc/ada/libgnat/s-conca3.adb --- a/gcc/ada/libgnat/s-conca3.adb +++ b/gcc/ada/libgnat/s-conca3.adb @@ -29,8 +29,6 @@ -- -- ------------------------------------------------------------------------------ -with System.Concat_2; - package body System.Concat_3 is pragma Suppress (All_Checks); @@ -52,25 +50,8 @@ package body System.Concat_3 is R (F .. L) := S2; F := L + 1; - L := R'Last; + L := F + S3'Length - 1; R (F .. L) := S3; end Str_Concat_3; - ------------------------- - -- Str_Concat_Bounds_3 -- - ------------------------- - - procedure Str_Concat_Bounds_3 - (Lo, Hi : out Natural; - S1, S2, S3 : String) - is - begin - System.Concat_2.Str_Concat_Bounds_2 (Lo, Hi, S2, S3); - - if S1 /= "" then - Hi := S1'Last + Hi - Lo + 1; - Lo := S1'First; - end if; - end Str_Concat_Bounds_3; - end System.Concat_3; diff --git a/gcc/ada/libgnat/s-conca3.ads b/gcc/ada/libgnat/s-conca3.ads --- a/gcc/ada/libgnat/s-conca3.ads +++ b/gcc/ada/libgnat/s-conca3.ads @@ -36,15 +36,8 @@ package System.Concat_3 is procedure Str_Concat_3 (R : out String; S1, S2, S3 : String); -- Performs the operation R := S1 & S2 & S3. The bounds of R are known to - -- be correct (usually set by a call to the Str_Concat_Bounds_3 procedure - -- below), so no bounds checks are required, and it is known that none of - -- the input operands overlaps R. No assumptions can be made about the + -- be sufficient so no bound checks are required, and it is known that none + -- of the input operands overlaps R. No assumptions can be made about the -- lower bounds of any of the operands. - procedure Str_Concat_Bounds_3 - (Lo, Hi : out Natural; - S1, S2, S3 : String); - -- Assigns to Lo..Hi the bounds of the result of concatenating the three - -- given strings, following the rules in the RM regarding null operands. - end System.Concat_3; diff --git a/gcc/ada/libgnat/s-conca4.adb b/gcc/ada/libgnat/s-conca4.adb --- a/gcc/ada/libgnat/s-conca4.adb +++ b/gcc/ada/libgnat/s-conca4.adb @@ -29,8 +29,6 @@ -- -- ------------------------------------------------------------------------------ -with System.Concat_3; - package body System.Concat_4 is pragma Suppress (All_Checks); @@ -56,25 +54,8 @@ package body System.Concat_4 is R (F .. L) := S3; F := L + 1; - L := R'Last; + L := F + S4'Length - 1; R (F .. L) := S4; end Str_Concat_4; - ------------------------- - -- Str_Concat_Bounds_4 -- - ------------------------- - - procedure Str_Concat_Bounds_4 - (Lo, Hi : out Natural; - S1, S2, S3, S4 : String) - is - begin - System.Concat_3.Str_Concat_Bounds_3 (Lo, Hi, S2, S3, S4); - - if S1 /= "" then - Hi := S1'Last + Hi - Lo + 1; - Lo := S1'First; - end if; - end Str_Concat_Bounds_4; - end System.Concat_4; diff --git a/gcc/ada/libgnat/s-conca4.ads b/gcc/ada/libgnat/s-conca4.ads --- a/gcc/ada/libgnat/s-conca4.ads +++ b/gcc/ada/libgnat/s-conca4.ads @@ -36,15 +36,8 @@ package System.Concat_4 is procedure Str_Concat_4 (R : out String; S1, S2, S3, S4 : String); -- Performs the operation R := S1 & S2 & S3 & S4. The bounds - -- of R are known to be correct (usually set by a call to the - -- Str_Concat_Bounds_5 procedure below), so no bounds checks are required, + -- of R are known to be sufficient so no bound checks are required, -- and it is known that none of the input operands overlaps R. No -- assumptions can be made about the lower bounds of any of the operands. - procedure Str_Concat_Bounds_4 - (Lo, Hi : out Natural; - S1, S2, S3, S4 : String); - -- Assigns to Lo..Hi the bounds of the result of concatenating the four - -- given strings, following the rules in the RM regarding null operands. - end System.Concat_4; diff --git a/gcc/ada/libgnat/s-conca5.adb b/gcc/ada/libgnat/s-conca5.adb --- a/gcc/ada/libgnat/s-conca5.adb +++ b/gcc/ada/libgnat/s-conca5.adb @@ -29,8 +29,6 @@ -- -- ------------------------------------------------------------------------------ -with System.Concat_4; - package body System.Concat_5 is pragma Suppress (All_Checks); @@ -60,25 +58,8 @@ package body System.Concat_5 is R (F .. L) := S4; F := L + 1; - L := R'Last; + L := F + S5'Length - 1; R (F .. L) := S5; end Str_Concat_5; - ------------------------- - -- Str_Concat_Bounds_5 -- - ------------------------- - - procedure Str_Concat_Bounds_5 - (Lo, Hi : out Natural; - S1, S2, S3, S4, S5 : String) - is - begin - System.Concat_4.Str_Concat_Bounds_4 (Lo, Hi, S2, S3, S4, S5); - - if S1 /= "" then - Hi := S1'Last + Hi - Lo + 1; - Lo := S1'First; - end if; - end Str_Concat_Bounds_5; - end System.Concat_5; diff --git a/gcc/ada/libgnat/s-conca5.ads b/gcc/ada/libgnat/s-conca5.ads --- a/gcc/ada/libgnat/s-conca5.ads +++ b/gcc/ada/libgnat/s-conca5.ads @@ -36,15 +36,8 @@ package System.Concat_5 is procedure Str_Concat_5 (R : out String; S1, S2, S3, S4, S5 : String); -- Performs the operation R := S1 & S2 & S3 & S4 & S5. The bounds - -- of R are known to be correct (usually set by a call to the - -- Str_Concat_Bounds_5 procedure below), so no bounds checks are required, + -- of R are known to be sufficient so no bound checks are required, -- and it is known that none of the input operands overlaps R. No -- assumptions can be made about the lower bounds of any of the operands. - procedure Str_Concat_Bounds_5 - (Lo, Hi : out Natural; - S1, S2, S3, S4, S5 : String); - -- Assigns to Lo..Hi the bounds of the result of concatenating the five - -- given strings, following the rules in the RM regarding null operands. - end System.Concat_5; diff --git a/gcc/ada/libgnat/s-conca6.adb b/gcc/ada/libgnat/s-conca6.adb --- a/gcc/ada/libgnat/s-conca6.adb +++ b/gcc/ada/libgnat/s-conca6.adb @@ -29,8 +29,6 @@ -- -- ------------------------------------------------------------------------------ -with System.Concat_5; - package body System.Concat_6 is pragma Suppress (All_Checks); @@ -64,25 +62,8 @@ package body System.Concat_6 is R (F .. L) := S5; F := L + 1; - L := R'Last; + L := F + S6'Length - 1; R (F .. L) := S6; end Str_Concat_6; - ------------------------- - -- Str_Concat_Bounds_6 -- - ------------------------- - - procedure Str_Concat_Bounds_6 - (Lo, Hi : out Natural; - S1, S2, S3, S4, S5, S6 : String) - is - begin - System.Concat_5.Str_Concat_Bounds_5 (Lo, Hi, S2, S3, S4, S5, S6); - - if S1 /= "" then - Hi := S1'Last + Hi - Lo + 1; - Lo := S1'First; - end if; - end Str_Concat_Bounds_6; - end System.Concat_6; diff --git a/gcc/ada/libgnat/s-conca6.ads b/gcc/ada/libgnat/s-conca6.ads --- a/gcc/ada/libgnat/s-conca6.ads +++ b/gcc/ada/libgnat/s-conca6.ads @@ -36,15 +36,8 @@ package System.Concat_6 is procedure Str_Concat_6 (R : out String; S1, S2, S3, S4, S5, S6 : String); -- Performs the operation R := S1 & S2 & S3 & S4 & S5 & S6. The - -- bounds of R are known to be correct (usually set by a call to the - -- Str_Concat_Bounds_6 procedure below), so no bounds checks are required, + -- bounds of R are known to be sufficient so no bound checks are required, -- and it is known that none of the input operands overlaps R. No -- assumptions can be made about the lower bounds of any of the operands. - procedure Str_Concat_Bounds_6 - (Lo, Hi : out Natural; - S1, S2, S3, S4, S5, S6 : String); - -- Assigns to Lo..Hi the bounds of the result of concatenating the six - -- given strings, following the rules in the RM regarding null operands. - end System.Concat_6; diff --git a/gcc/ada/libgnat/s-conca7.adb b/gcc/ada/libgnat/s-conca7.adb --- a/gcc/ada/libgnat/s-conca7.adb +++ b/gcc/ada/libgnat/s-conca7.adb @@ -29,8 +29,6 @@ -- -- ------------------------------------------------------------------------------ -with System.Concat_6; - package body System.Concat_7 is pragma Suppress (All_Checks); @@ -71,25 +69,8 @@ package body System.Concat_7 is R (F .. L) := S6; F := L + 1; - L := R'Last; + L := F + S7'Length - 1; R (F .. L) := S7; end Str_Concat_7; - ------------------------- - -- Str_Concat_Bounds_7 -- - ------------------------- - - procedure Str_Concat_Bounds_7 - (Lo, Hi : out Natural; - S1, S2, S3, S4, S5, S6, S7 : String) - is - begin - System.Concat_6.Str_Concat_Bounds_6 (Lo, Hi, S2, S3, S4, S5, S6, S7); - - if S1 /= "" then - Hi := S1'Last + Hi - Lo + 1; - Lo := S1'First; - end if; - end Str_Concat_Bounds_7; - end System.Concat_7; diff --git a/gcc/ada/libgnat/s-conca7.ads b/gcc/ada/libgnat/s-conca7.ads --- a/gcc/ada/libgnat/s-conca7.ads +++ b/gcc/ada/libgnat/s-conca7.ads @@ -38,15 +38,8 @@ package System.Concat_7 is (R : out String; S1, S2, S3, S4, S5, S6, S7 : String); -- Performs the operation R := S1 & S2 & S3 & S4 & S5 & S6 & S7. The - -- bounds of R are known to be correct (usually set by a call to the - -- Str_Concat_Bounds_8 procedure below), so no bounds checks are required, + -- bounds of R are known to be sufficient so no bound checks are required, -- and it is known that none of the input operands overlaps R. No -- assumptions can be made about the lower bounds of any of the operands. - procedure Str_Concat_Bounds_7 - (Lo, Hi : out Natural; - S1, S2, S3, S4, S5, S6, S7 : String); - -- Assigns to Lo..Hi the bounds of the result of concatenating the seven - -- given strings, following the rules in the RM regarding null operands. - end System.Concat_7; diff --git a/gcc/ada/libgnat/s-conca8.adb b/gcc/ada/libgnat/s-conca8.adb --- a/gcc/ada/libgnat/s-conca8.adb +++ b/gcc/ada/libgnat/s-conca8.adb @@ -29,8 +29,6 @@ -- -- ------------------------------------------------------------------------------ -with System.Concat_7; - package body System.Concat_8 is pragma Suppress (All_Checks); @@ -75,26 +73,8 @@ package body System.Concat_8 is R (F .. L) := S7; F := L + 1; - L := R'Last; + L := F + S8'Length - 1; R (F .. L) := S8; end Str_Concat_8; - ------------------------- - -- Str_Concat_Bounds_8 -- - ------------------------- - - procedure Str_Concat_Bounds_8 - (Lo, Hi : out Natural; - S1, S2, S3, S4, S5, S6, S7, S8 : String) - is - begin - System.Concat_7.Str_Concat_Bounds_7 - (Lo, Hi, S2, S3, S4, S5, S6, S7, S8); - - if S1 /= "" then - Hi := S1'Last + Hi - Lo + 1; - Lo := S1'First; - end if; - end Str_Concat_Bounds_8; - end System.Concat_8; diff --git a/gcc/ada/libgnat/s-conca8.ads b/gcc/ada/libgnat/s-conca8.ads --- a/gcc/ada/libgnat/s-conca8.ads +++ b/gcc/ada/libgnat/s-conca8.ads @@ -38,15 +38,8 @@ package System.Concat_8 is (R : out String; S1, S2, S3, S4, S5, S6, S7, S8 : String); -- Performs the operation R := S1 & S2 & S3 & S4 & S5 & S6 & S7 & S8. - -- The bounds of R are known to be correct (usually set by a call to the - -- Str_Concat_Bounds_8 procedure below), so no bounds checks are required, - -- and it is known that none of the input operands overlaps R. No + -- The bounds of R are known to be sufficient so no bound checks are + -- required and it is known that none of the input operands overlaps R. No -- assumptions can be made about the lower bounds of any of the operands. - procedure Str_Concat_Bounds_8 - (Lo, Hi : out Natural; - S1, S2, S3, S4, S5, S6, S7, S8 : String); - -- Assigns to Lo..Hi the bounds of the result of concatenating the eight - -- given strings, following the rules in the RM regarding null operands. - end System.Concat_8; diff --git a/gcc/ada/libgnat/s-conca9.adb b/gcc/ada/libgnat/s-conca9.adb --- a/gcc/ada/libgnat/s-conca9.adb +++ b/gcc/ada/libgnat/s-conca9.adb @@ -29,8 +29,6 @@ -- -- ------------------------------------------------------------------------------ -with System.Concat_8; - package body System.Concat_9 is pragma Suppress (All_Checks); @@ -79,26 +77,8 @@ package body System.Concat_9 is R (F .. L) := S8; F := L + 1; - L := R'Last; + L := F + S9'Length - 1; R (F .. L) := S9; end Str_Concat_9; - ------------------------- - -- Str_Concat_Bounds_9 -- - ------------------------- - - procedure Str_Concat_Bounds_9 - (Lo, Hi : out Natural; - S1, S2, S3, S4, S5, S6, S7, S8, S9 : String) - is - begin - System.Concat_8.Str_Concat_Bounds_8 - (Lo, Hi, S2, S3, S4, S5, S6, S7, S8, S9); - - if S1 /= "" then - Hi := S1'Last + Hi - Lo + 1; - Lo := S1'First; - end if; - end Str_Concat_Bounds_9; - end System.Concat_9; diff --git a/gcc/ada/libgnat/s-conca9.ads b/gcc/ada/libgnat/s-conca9.ads --- a/gcc/ada/libgnat/s-conca9.ads +++ b/gcc/ada/libgnat/s-conca9.ads @@ -38,15 +38,8 @@ package System.Concat_9 is (R : out String; S1, S2, S3, S4, S5, S6, S7, S8, S9 : String); -- Performs the operation R := S1 & S2 & S3 & S4 & S5 & S6 & S7 & S8 & S9. - -- The bounds of R are known to be correct (usually set by a call to the - -- Str_Concat_Bounds_9 procedure below), so no bounds checks are required, - -- and it is known that none of the input operands overlaps R. No + -- The bounds of R are known to be sufficient so no bound checks are + -- required, and it is known that none of the input operands overlaps R. No -- assumptions can be made about the lower bounds of any of the operands. - procedure Str_Concat_Bounds_9 - (Lo, Hi : out Natural; - S1, S2, S3, S4, S5, S6, S7, S8, S9 : String); - -- Assigns to Lo..Hi the bounds of the result of concatenating the nine - -- given strings, following the rules in the RM regarding null operands. - end System.Concat_9; diff --git a/gcc/ada/rtsfind.ads b/gcc/ada/rtsfind.ads --- a/gcc/ada/rtsfind.ads +++ b/gcc/ada/rtsfind.ads @@ -910,15 +910,6 @@ package Rtsfind is RE_Str_Concat_8, -- System.Concat_8 RE_Str_Concat_9, -- System.Concat_9 - RE_Str_Concat_Bounds_2, -- System.Concat_2 - RE_Str_Concat_Bounds_3, -- System.Concat_3 - RE_Str_Concat_Bounds_4, -- System.Concat_4 - RE_Str_Concat_Bounds_5, -- System.Concat_5 - RE_Str_Concat_Bounds_6, -- System.Concat_6 - RE_Str_Concat_Bounds_7, -- System.Concat_7 - RE_Str_Concat_Bounds_8, -- System.Concat_8 - RE_Str_Concat_Bounds_9, -- System.Concat_9 - RE_Get_Active_Partition_Id, -- System.DSA_Services RE_Get_Local_Partition_Id, -- System.DSA_Services RE_Get_Passive_Partition_Id, -- System.DSA_Services @@ -2608,15 +2599,6 @@ package Rtsfind is RE_Str_Concat_8 => System_Concat_8, RE_Str_Concat_9 => System_Concat_9, - RE_Str_Concat_Bounds_2 => System_Concat_2, - RE_Str_Concat_Bounds_3 => System_Concat_3, - RE_Str_Concat_Bounds_4 => System_Concat_4, - RE_Str_Concat_Bounds_5 => System_Concat_5, - RE_Str_Concat_Bounds_6 => System_Concat_6, - RE_Str_Concat_Bounds_7 => System_Concat_7, - RE_Str_Concat_Bounds_8 => System_Concat_8, - RE_Str_Concat_Bounds_9 => System_Concat_9, - RE_Get_Active_Partition_Id => System_DSA_Services, RE_Get_Local_Partition_Id => System_DSA_Services, RE_Get_Passive_Partition_Id => System_DSA_Services,