Description of problem: wchar_t *wcswcs(wchar_t *, wchar_t *) does not return valid address. Version-Release number of selected component (if applicable): glibc-2.3.2-95.6 gcc-3.2.3-24 Architecture used is Itanium 2. How reproducible: Please find the test case attached to this bug report. Steps to Reproduce: 1. Compile the C test case using: gcc test.c 2. Run the executable a.out ./a.out Actual results: Segmentation fault (core dumped) Expected results: Len=3 Additional info: The same test case works on i686 and fails on ia64
Created attachment 103331 [details] C program This is a C program to reproduce the problem
It always help to compile with warnings enabled. gcc -Wall test.c test.c: In function `main': test.c:13: warning: implicit declaration of function `mbstowcs' test.c:17: warning: implicit declaration of function `wcswcs' test.c:17: warning: assignment makes pointer from integer without a cast test.c:31: warning: implicit declaration of function `wcstombs' test.c:32: warning: implicit declaration of function `strlen' test.c:33: warning: int format, different type arg (arg 2) makes it clear that you are missing some includes (particularly #include <string.h> #include <stdlib.h> ) and also, given that wcswcs is a X/Open only function (ISO C99 uses wcsstr), you need to enable X/Open feature set, see info libc on Feature Set Macros. I.e. if you add those two includes and compile with -D_XOPEN_SOURCE, -D_GNU_SOURCE, -D_XOPEN_SOURCE=600 or similar, it will work just fine. Unprototyped functions are assumed to return int, so really bad things happen on 64-bit arches for functions which return pointers or other 64-bit values or on all arches if they return floating point values and prototypes aren't used.