Crush in strtok

Igor Levko hornet@reksoft.ru
Wed Jul 8 02:35:00 GMT 1998


Hello,

I have gcc version egcs-2.90.29 980515 (egcs-1.0.3 release)
for Solaris 2.5.1.
Having compiled this simplest test I invoked it and got
segmentation fault.

#include <stdio.h>
#include <string.h>

int main()
{
  char* str = "one two three";
  char* ptr = strtok(str, " ");
  while (ptr)
    {
      printf("[%s]\n", ptr);
      ptr = strtok(NULL, " ");
    }
  
  return 1;
}

gdb said that the exeption had taken place somewhere in strtok_r call.

I'm not sure if it's the compiler's bug but I tryed some other compilers
and everything was fine.

Best regards,
Igor Levko
e-mail:hornet@reksoft.ru



More information about the Gcc-bugs mailing list