std::string::assign
Richard Kojedzinszky
krichy@tvnetwork.hu
Tue Aug 28 09:30:00 GMT 2012
Dear All,
I've a strange bug, I've attached a small source which shows my issue.
So, I am trying to assign a string containing an embedded \0 in it. You
will find that in test() I use std::string::assign to do this, but in two
cases the results are different.
Please see the output of the attached source, and let me know if I am
missing something, or it is a bug in g++/stdc++.
Of course, the third form in test() works as expected, but in my
assumption all should.
With this g++ it behaves bad:
$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.7.1-2'
--with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs
--enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.7 --enable-shared --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--enable-gnu-unique-object --enable-plugin --enable-objc-gc
--with-arch-32=i586 --with-tune=generic --enable-checking=release
--build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.7.1 (Debian 4.7.1-2)
But with freebsd's g++:
$ g++ -v
Using built-in specs.
Target: amd64-undermydesk-freebsd
Configured with: FreeBSD/amd64 system compiler
Thread model: posix
gcc version 4.2.1 20070831 patched [FreeBSD]
It works fine.
Thanks in advance,
Kojedzinszky Richard
Euronet Magyarorszag Informatikai Zrt.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: stringtest.cpp
Type: text/x-c++src
Size: 577 bytes
Desc:
URL: <http://gcc.gnu.org/pipermail/gcc-bugs/attachments/20120828/f6d29506/attachment.bin>
More information about the Gcc-bugs
mailing list