Ion GaztaƱaga
Please try SVN trunk code, I think it contains fixes for GCC optimizations.
Sure enough, it looks like this fixes it. Stock GCC and Boost are 4.5.1 and 1.44.0, respectively: $ rpm -q gcc boost gcc-4.5.1-4.fc14.x86_64 boost-1.44.0-8.fc14.x86_64 Updated versions are GCC 4.6.0 and trunk r73469: $ /usr/local/gcc/bin/g++ --version g++ (GCC) 4.6.0 Copyright (C) 2011 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ ( cd ~/Source/boost/trunk ; svn info ) Path: . URL: http://svn.boost.org/svn/boost/trunk Repository Root: http://svn.boost.org/svn/boost Repository UUID: b8fc166d-592f-0410-95f2-cb63ce0dd405 Revision: 73469 Node Kind: directory Schedule: normal Last Changed Author: artyom Last Changed Rev: 73469 Last Changed Date: 2011-08-01 02:04:27 -0600 (Mon, 01 Aug 2011) Binaries: $ g++ -O2 InterProcStringTest3.cpp -o InterProcStringTest3-gcc_4.5.1-boost_1.44.0-O2 -lpthread -lrt $ g++ -isystem ~/Source/boost/trunk -O2 InterProcStringTest3.cpp -o InterProcStringTest3-gcc_4.5.1-boost_r73469-O2 -lpthread -lrt $ /usr/local/gcc/bin/g++ -O2 InterProcStringTest3.cpp -o InterProcStringTest3-gcc_4.6.0-boost_1.44.0-O2 -lpthread -lrt $ /usr/local/gcc/bin/g++ -isystem ~/Source/boost/trunk -O2 InterProcStringTest3.cpp -o InterProcStringTest3-gcc_4.6.0-boost_r73469-O2 -lpthread -lrt Results: $ for i in InterProcStringTest3-* ; do echo "=== $i ===" ; ./$i ; echo ; done === InterProcStringTest3-gcc_4.5.1-boost_1.44.0-O2 === InterProcStringTest3.cpp(150): test sv1 == sv3 failed in function: 'int test_main(int, char**)' sv1="y\xffffffe2y", sv3="yyy" InterProcStringTest3.cpp(162): test sv1 == sv5 failed in function: 'int test_main(int, char**)' sv1="yyy\xffffffe2yy", sv5="yyyyyy" **** 2 errors detected === InterProcStringTest3-gcc_4.5.1-boost_r73469-O2 === **** no errors detected === InterProcStringTest3-gcc_4.6.0-boost_1.44.0-O2 === InterProcStringTest3.cpp(150): test sv1 == sv3 failed in function: 'int test_main(int, char**)' sv1="y\x03y", sv3="yyy" InterProcStringTest3.cpp(162): test sv1 == sv5 failed in function: 'int test_main(int, char**)' sv1="yyy\x03yy", sv5="yyyyyy" **** 2 errors detected === InterProcStringTest3-gcc_4.6.0-boost_r73469-O2 === **** no errors detected I'm actually somewhat surprised; I thought that 4.6.0 did the right thing even with 1.44.0, but apparently not. Either way, I think that I'm past this particular problem. Thanks yet again for all the suggestions and other input. Best regards, Tony