From Bugzilla Helper: User-Agent: Mozilla/4.77 [ru] (X11; U; SunOS 5.8 sun4d) Description of problem: re_search_2 fails if length2==0 (length of the second half of text). How reproducible: Always Steps to Reproduce: 1. compile and run attached test program 2. 3. Actual Results: it says: BUG Expected Results: it should say: pos=4 Additional info: It seems to be a miscompilation of glibc, since if I use exact the same regex.c from glibc-2.2.2 and compile it along with test program, it works fine. glibcbug indicates that gcc-2.96-79 was used to compile glibc, while redhat-7.1 ships with gcc-2.96-81.
Created attachment 18166 [details] test program
What makes you think it is a miscompilation? regex code changed quite a bit lately to support multibyte character sets. Anyway, I've fixed this in http://sources.redhat.com/ml/libc-hacker/2001-05/msg00024.html it will appear in the next glibc rpms.
Maybe in glibc regex was just compiled with some defines, like MBS_SUPPORT. When I tried to compile it manually, I did not supply any extra defines.
Fixed in glibc-2.2.3-6 and above.