https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85824
--- Comment #2 from Wanying Luo <wanyingloo at gmail dot com> --- (In reply to Wanying Luo from comment #0) > When I ran this test on a Linux machine with GCC 4.9.2, glibc's strxfrm() > converts 0x80 to 6 bytes. Pasting my test on Linux with the same version of GCC for completeness. $ cat test.cpp #include <locale.h> #include <regex> int main (int argc, char *argv[]) { setlocale(LC_ALL, ""); std::regex("[0-9]"); } $ echo $LANG en_US.UTF-8 $ g++ -std=c++11 test.cpp $ ./a.out $ cat more_test.cpp #include <locale.h> #include <errno.h> #include <stdio.h> #include <string.h> int main (int argc, char *argv[]) { setlocale(LC_ALL, ""); char a[] = { 0x80, '\0' }; printf("%lu\n", strxfrm(NULL, a, 0)); printf("%s\n", strerror(errno)); } $ g++ -std=c++11 -w more_test.cpp $ ./a.out 6 Success $ uname -a Linux d-ubuntu12x64-11 3.2.0-126-generic #169-Ubuntu SMP Fri Mar 31 14:15:21 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux $ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/home/wluo/othello/linux64-packages/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.9.2/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: ../gcc-4.9.2/configure --prefix=/usr --with-local-prefix=/usr/local --enable-languages=c,c++,fortran --disable-nls --disable-libcilkrts --disable-lto --enable-libstdcxx-time --enable-clocale=generic --with-stage1-ldflags='-L/slowfs/sighome/calebs/working/platform-packages-build/idir/linux64/stage1-packages/lib64 -L/slowfs/sighome/calebs/working/platform-packages-build/idir/linux64/stage1-packages/lib' --with-boot-ldflags='-L/slowfs/sighome/calebs/working/platform-packages-build/idir/linux64/stage1-packages/lib64 -L/slowfs/sighome/calebs/working/platform-packages-build/idir/linux64/stage1-packages/lib' --disable-werror --disable-multiarch --disable-bootstrap Thread model: posix gcc version 4.9.2 (GCC)