[Ada] fix spitbol bug
Arnaud Charlet
charlet@adacore.com
Tue Oct 31 20:01:00 GMT 2006
Tested on i686-linux, committed on trunk.
If a one character string is used as a parameter to one of the spitbol
pattern matching routines, and the lower bound is other than one (this
most typically happens from the use of a slice), then the routine may
malfunction. This is because there was an explicit use of Str (0) which
should have been Str (Str'First) in S_To_PE.
See gnat.dg/spipaterr.adb
2006-10-31 Robert Dewar <dewar@adacore.com>
* g-spipat.adb (S_To_PE): Remove incorrect use of 0 instead of Str'First
-------------- next part --------------
Index: g-spipat.adb
===================================================================
--- g-spipat.adb (revision 118179)
+++ g-spipat.adb (working copy)
@@ -3431,7 +3431,7 @@ package body GNAT.Spitbol.Patterns is
return new PE'(PC_Null, 1, EOP);
when 1 =>
- return new PE'(PC_Char, 1, EOP, Str (1));
+ return new PE'(PC_Char, 1, EOP, Str (Str'First));
when 2 =>
return new PE'(PC_String_2, 1, EOP, Str);
More information about the Gcc-patches
mailing list