$ cat test.c 
#include <string.h>
#include <stdio.h>

int main(void) {
        char *tmp;
        const char * const delim=" ";
        tmp=strtok("a b c", delim);
        printf("%s\n",tmp);
        return 0;
}
$ gcc -Wall test.c
$ ./a.out 
Segmentation fault (core dumped)
$ gcc -Wall -fwritable-strings test.c
cc1: note: -fwritable-strings is deprecated; see documentation for details
$ ./a.out
a
$

-- 
           Summary: strtok and strtok_r do not work without -fwritable-
                    strings
           Product: gcc
           Version: 3.4.4
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: roger at systemroot dot org
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19582

Reply via email to