This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Crush in strtok


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]