$ gnatmake rtest.adb gcc -c rtest.adb gnatbind -x rtest.ali gnatlink rtest.ali $ ./rtest raised STORAGE_ERROR : stack overflow (or erroneous memory access) Also occurs with GNAT GPL 2008. -- chop here -- with Gnat.Regexp; procedure RTest is R : constant Gnat.Regexp.Regexp := Gnat.Regexp.Compile (Pattern => ".*AB.*|.*XYZ.*|.*0123456.*"); B : Boolean; begin B := Gnat.Regexp.Match("A", R); end;
Confirmed on 4.4.0 20080803 (i686-pc-linux-gnu).
If I unsupress checks in System.Regexp.Compile.Create_Secondary_Table, then I get "raised CONSTRAINT_ERROR : s-regexp.adb:1161 index check failed" here: 1160 for Column in 0 .. Alphabet_Size loop 1161 Meta_States (Nb_State + 1) := (others => False); -- Here 1162 Temp_State_Not_Null := False; The reason is that Nb_State + 1 is beyond Meta_States'Last.
2014-01-29 Emmanuel Briot <briot@adacore.com> * s-regexp.adb (Create_Secondary_Table): Automatically grow the state machine as needed. (Dump): New subprogram.