bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question about POSIX regex support


From: Bruno Haible
Subject: Re: Question about POSIX regex support
Date: Fri, 22 Jun 2007 02:07:24 +0200
User-agent: KMail/1.5.4

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?

> 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-bit
wide, whereas the regoff_t that gnulib's regex module is using is 64-bit
wide.

Here's a checklist:

  1) Verify the values of sizeof (regoff_t) in three different configurations:
     - with the system header (-I/usr/include)
     - with the gnulib regex.h and with config.h (-Ilib -DHAVE_CONFIG_H)
     - with the gnulib regex.h and without config.h (-Ilib)
     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 uses
     the regex.h from gnulib, not the one from /usr/include.

  3) Verify that every source file that includes gnulib headers starts out
     with   #include <config.h>.


Bruno





reply via email to

[Prev in Thread] Current Thread [Next in Thread]