[cfe-dev] libc++ miscompilation on trunk?

İsmail Dönmez ismail at donmez.ws
Mon Jun 29 04:08:48 PDT 2015


A regression between r240624 and r240761 resulted in new regressions
on my Linux x86-64 box and one of them is

int main(): Assertion `sb.str() == L"-$1,234,567.89"' failed.

Looking under gdb it looks like the data is corrupted:

(gdb) frame 4
#4  0x0000000000403bab in main () at
80              assert(sb.str() == L"-$1,234,567.89");
(gdb) print sb.str()
$1 = {<std::__1::__basic_string_common<true>> = {<No data fields>},
  __r_ = {<std::__1::__libcpp_compressed_pair_imp<std::__1::basic_string<wchar_t,
std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::__rep,
std::__1::allocator<wchar_t>, 2>> = {<std::__1::allocator<wchar_t>> =
{<No data fields>},
      __first_ = {{__l = {__cap_ = 9, __size_ = 6, __data_ = 0x609160
L"-$\x60e9b0.\x60e9b0\x60e9b0"}, __s = {{
              __size_ = 9 '\t', __lx = 9 L'\t'}, __data_ =
L"\000\006\000\x609160"}, __r = {__words = {9, 6,
              6328672}}}}}, <No data fields>}, static npos =

This only seems to happen with wchar_t types so the next test on line
89 fails too. Just for reference I build clang in two stages so libcxx
is built with stage2 compiler. I see the failure on openSUSE 13.2
where no system package has changed so this is unlikely to be an
outside bug.

Any ideas?


More information about the cfe-dev mailing list