Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 09 Jul 2013 20:08:22 +0200
From:      Michael Sperber <sperber@deinprogramm.de>
To:        freebsd-stable@freebsd.org
Subject:   Weird regex behavior on 9.1-RELEASE on amd64 in 32-bit mode
Message-ID:  <y9lppura9nt.fsf@deinprogramm.de>

next in thread | raw e-mail | index | archive | help

I noticed that scsh (which only runs in 32-bit mode) fails on amd64.  I
narrowed it down to a regex malfunction (I think).  This program:

----snip----
#include <regex.h>
#include <stdio.h>

int
main(void)
{
  regex_t r;
  int status = regcomp(&r, "/afs", REG_EXTENDED);
  size_t nmatch   = 1 + r.re_nsub;
  regmatch_t pmatch[32];
  status = regexec(&r, "/afs/informatik", nmatch, pmatch, 0);
  {
    int i;
    for(i = 0; i < nmatch; i--) {
      printf("%d: %d - %d\n", i, (int) pmatch[i].rm_so, (int) pmatch[i].rm_eo);
    }
  }
  return 0;
}
----snip----

This giveds me:

# gcc r.c
# ./a.out
0: 0 - 4
# gcc -m32 r.c
# ./a.out
0: 0 - 0

Is it me or is there a bug?  Help would be much appreciated!

-- 
Regards,
Mike




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?y9lppura9nt.fsf>