libc++ miscompilation on trunk?


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?


Btw, exact failure list looks like this:

libc++ :: std/input.output/iostream.format/ext.manip/get_money.pass.cpp
libc++ :: std/input.output/iostream.format/ext.manip/get_time.pass.cpp
libc++ :: std/input.output/iostream.format/ext.manip/put_money.pass.cpp
libc++ :: std/input.output/iostream.format/ext.manip/put_time.pass.cpp
libc++ :: std/localization/locale.categories/category.ctype/locale.ctype.byname/narrow_1.pass.cpp
libc++ :: std/localization/locale.categories/category.ctype/locale.ctype.byname/narrow_many.pass.cpp
libc++ :: std/localization/locale.categories/category.time/locale.time.get.byname/date_order_wide.pass.cpp

Thanks for the report.
I'm not seeing any of these tests failing on my Darwin box.

(I'm not disbelieving you, just adding more information)

-- Marshall