[Ada] Semantics of Delete for fixed strings

Pierre-Marie de Rodat derodat@adacore.com
Mon Jul 8 08:19:00 GMT 2019


This patch corrects a bug in the implementation of Delete in an unusual
boundary case: the RM describes the semantics of Delete as equivalent to
that of Replace_String with a null argument. As a result, deleting a
null string that starts past the end of its argument is a noop and must
not raise Index_Error.

Tested on x86_64-pc-linux-gnu, committed on trunk

2019-07-08  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

	* libgnat/a-strfix.adb (Delete): The RM describes the semantics
	of Delete as equivalent to that of Replace_String with a null
	argument. As a result, deleting a null string that starts past
	the end of its argument is a noop and must not raise
	Index_Error.

gcc/testsuite/

	* gnat.dg/fixed_delete.adb: New testcase.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: text/x-diff
Size: 1173 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20190708/2bf4edf0/attachment.bin>


More information about the Gcc-patches mailing list