gcc-2.95.3 && Glibc 2.2: wprintf problem with g++
Andreas Jaeger
aj@suse.de
Wed Dec 20 07:48:00 GMT 2000
>>>>> Bernd Schmidt writes:
> On 13 Dec 2000, Andreas Jaeger wrote:
>> The following program fails if compiled with g++ from gcc 2.95.3 CVS
>> on Linux/i686 with glibc 2.2 with a segmentation fault:
>>
>> #include <wchar.h>
>>
>> int main()
>> {
>> wprintf(L"%s\n", "Just a test");
>> }
>>
>> It seems that struct stdout is not set up properly for wide streams in
>> libstdc++.
> I can't reproduce this with current 2.95.3 CVS. Please verify whether it
> still fails for you. If so, I need to know the exact command line options
> you used to compile it.
I just tried it (with a new cvs update) - and it still fails for me.
I configured on a glibc 2.2 based system (i686, Linux 2.2.16):
/cvs/gcc-2.95/configure --prefix=/opt/test-2.95 --enable-shared --disable-nls
and run make bootstrap;make install
gee:/builds/gcc/2.95:[1]$ /opt/test-2.95/bin/g++ -o Wchar ~/wc.c -D_GNU_SOURCE -Wall
gee:/builds/gcc/2.95:[0]$ ldd ./Wchar
libstdc++-libc6.2-2.so.3 => /usr/lib/libstdc++-libc6.2-2.so.3 (0x40023000)
libm.so.6 => /lib/libm.so.6 (0x4006c000)
libc.so.6 => /lib/libc.so.6 (0x4008a000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
gee:/builds/gcc/2.95:[0]$ LD_LIBRARY_PATH=/opt/test-2.95/lib/ ldd ./Wchar
libstdc++-libc6.2-2.so.3 => /opt/test-2.95/lib/libstdc++-libc6.2-2.so.3 (0x40018000)
libm.so.6 => /lib/libm.so.6 (0x4006a000)
libc.so.6 => /lib/libc.so.6 (0x40088000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
gee:/builds/gcc/2.95:[0]$ LD_LIBRARY_PATH=/opt/test-2.95/lib/ ./Wchar
Segmentation fault
You need to have a *shared* libstdc++ for this, a static libstdc++
works just fine,
Andreas
--
Andreas Jaeger
SuSE Labs aj@suse.de
private aj@arthur.inka.de
http://www.suse.de/~aj
More information about the Gcc-bugs
mailing list