[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: strstr in gnulib
From: |
Bruno Haible |
Subject: |
Re: strstr in gnulib |
Date: |
Mon, 8 Nov 2010 18:29:01 +0100 |
User-agent: |
KMail/1.9.9 |
Hello Dilyan,
> When I use the latest strstr implemenation from gnulib in git, the
> following program crashes (causes Segmentation fault):
>
> #include <string.h>
> #include <stdio.h>
>
> void main() {
> char *find = strstr ("**AB** **CD** **AB** **CD** **CD**", "**CD**");
> printf("%s\n", find);
> }
>
> It does not crash when I use strstr from libc-2.9 .
I cannot reproduce it.
$ cat foo.c
#include <string.h>
#include <stdio.h>
int main() {
char *find = strstr ("**AB** **CD** **AB** **CD** **CD**", "**CD**");
printf("%s\n", find);
return 0;
}
$ gcc -Wall -O2 foo.c lib/strstr.c -I..
$ ./a.out
**CD** **AB** **CD** **CD**
Can you please give more details
1) about your platform (CPU, 32-bit or 64-bit), gcc version, compilation
flags,
2) Show the stack trace that you get when you compile with -g and without
optimization and then run gdb:
$ gdb a.out
(gdb) run
(gdb) where
Bruno
- strstr in gnulib, Дилян Палаузов, 2010/11/08
- Re: strstr in gnulib,
Bruno Haible <=