From 69b6b231df3bd6836ed8734b1a52b975aa1eb7c8 Mon Sep 17 00:00:00 2001 From: charlet Date: Mon, 1 Aug 2011 09:22:08 +0000 Subject: 2011-08-01 Pascal Obry * a-stzunb-shared.adb, a-strunb-shared.adb, a-stwiun-shared.adb: Fix Replace_Slice when High is above current string size. (Replace_Slice): Fix DL computation when High is above current string length. 2011-08-01 Gary Dismukes * gnat_rm.texi: Add documentation for pragma Static_Elaboration_Desired. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@177004 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/a-strunb-shared.adb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'gcc/ada/a-strunb-shared.adb') diff --git a/gcc/ada/a-strunb-shared.adb b/gcc/ada/a-strunb-shared.adb index bfa4875f588..b0e413dde8b 100644 --- a/gcc/ada/a-strunb-shared.adb +++ b/gcc/ada/a-strunb-shared.adb @@ -1347,7 +1347,9 @@ package body Ada.Strings.Unbounded is -- Do replace operation when removed slice is not empty if High >= Low then - DL := By'Length + SR.Last + Low - High - 1; + DL := By'Length + SR.Last + Low - Integer'Min (High, SR.Last) - 1; + -- This is the number of characters remaining in the string after + -- replacing the slice. -- Result is empty string, reuse empty shared string @@ -1394,7 +1396,9 @@ package body Ada.Strings.Unbounded is -- Do replace operation only when replaced slice is not empty if High >= Low then - DL := By'Length + SR.Last + Low - High - 1; + DL := By'Length + SR.Last + Low - Integer'Min (High, SR.Last) - 1; + -- This is the number of characters remaining in the string after + -- replacing the slice. -- Result is empty string, reuse empty shared string -- cgit v1.2.1