On Jun 21, 2007, at 6:07 PM, Bruno Haible wrote:
Hello, Gallagher James wrote:System specifics: Fedora Core 6, intel, gcc/++ 4.1.1.And what's the CPU? x86 or x86_64? 32-bit or 64-bit?
x86_64.
Problem 1: With a string "123abcdef" and a regex of "abc", after calling regex(...) the resulting pmatch[] has values very different than before. In the past the result of this call was that pmatch [0].rm_so was 3 and pmatch[0].rm_eo was 6. Now I get pmatch[0].rm_so = 3, pmatch[0].rm_eo = 0, pmatch[1].rm_so = 6 and pmatch[1].rm_eo = 0. It seems that the new result is not correct. Problem 2: Using valgrind I'm getting an Invalid write of 8 bytes on lines 950 and 951 of regexec.c.Both symptoms hint towards mismatching definitions of 'regoff_t'. Namely,it looks like the regoff_t that your program is using/seeing is 32-bitwide, whereas the regoff_t that gnulib's regex module is using is 64-bitwide.
Yup, that was it.
Here's a checklist:1) Verify the values of sizeof (regoff_t) in three different configurations:- with the system header (-I/usr/include)
32
- with the gnulib regex.h and with config.h (-Ilib - DHAVE_CONFIG_H)
64
- with the gnulib regex.h and without config.h (-Ilib)
32
Test program: #if HAVE_CONFIG_H # include <config.h> #endif #include <stdio.h> #include <regex.h>int main () { printf ("%d\n", 8 * sizeof (regoff_t)); return 0; }2) Verify that you have the -I option in place so that your program usesthe regex.h from gnulib, not the one from /usr/include.3) Verify that every source file that includes gnulib headers starts outwith #include <config.h>.
Problem fixed. Thanks very much! James
Bruno
-- James Gallagher jgallagher at opendap.org OPeNDAP, Inc 406.723.8663
