[Ada] Add missing regular expression syntax error check

Pierre-Marie de Rodat derodat@adacore.com
Tue Nov 9 09:45:46 GMT 2021


The procedure System.Regexp.Compile.Check_Well_Formed_Pattern is
intended to verify the syntactic correctness of a regular expression
pattern. It was failing to detect the (incorrect) case of a pattern that
ends in a "|".  Subsequent code depends on the pattern being correct, so
failing to detect this error led to other problems (discussed in the
ticket). Add the missing check.

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

gcc/ada/

	* libgnat/s-regexp.adb (Compile.Check_Well_Formed_Patern): When
	a "|" operator is encountered in a pattern, check that it is not
	the last character of the pattern.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: text/x-diff
Size: 979 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20211109/38804287/attachment.bin>


More information about the Gcc-patches mailing list