Michael Sperber
2013-Jul-09 18:08 UTC
Weird regex behavior on 9.1-RELEASE on amd64 in 32-bit mode
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
Konstantin Belousov
2013-Jul-09 18:23 UTC
Weird regex behavior on 9.1-RELEASE on amd64 in 32-bit mode
On Tue, Jul 09, 2013 at 08:08:22PM +0200, Michael Sperber wrote:> > 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!-m32 does not work on stable. You need HEAD. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 834 bytes Desc: not available URL: <http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20130709/23d264b7/attachment.sig>