diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-08-01 09:22:08 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-08-01 09:22:08 +0000 |
commit | 69b6b231df3bd6836ed8734b1a52b975aa1eb7c8 (patch) | |
tree | e2b94e114b55709602a6d89ccd45950da66fca16 /gcc/ada/a-strunb-shared.adb | |
parent | eeffeeaaf49c95490f8688c45d4f7423d349b478 (diff) | |
download | gcc-69b6b231df3bd6836ed8734b1a52b975aa1eb7c8.tar.gz |
2011-08-01 Pascal Obry <obry@adacore.com>
* 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 <dismukes@adacore.com>
* 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
Diffstat (limited to 'gcc/ada/a-strunb-shared.adb')
-rw-r--r-- | gcc/ada/a-strunb-shared.adb | 8 |
1 files changed, 6 insertions, 2 deletions
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 |