[libcxx-commits] [PATCH] D59178: [libc++] Speedup to_string and to_wstring for integers using stack buffer and SSO

Vlad Tsyrklevich via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jun 6 00:40:29 PDT 2019


vlad.tsyrklevich added a comment.

After this change landed I started getting odd failures with check-llvm with MSan or ASan like the following: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap-msan/builds/12853
/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm/test/ThinLTO/X86/dot-dumper-full-lto.ll:12:10: error: CHECK: expected string not found in input
; CHECK: subgraph cluster_4294967295
<stdin>:3:2: note: possible intended match here
 subgraph cluster_0004294967295 {

The error stems from that string being generated with:

  OS << "  subgraph cluster_" << std::to_string(ModId) << " {\n";

For some reason std::to_string((uint64_t)0xffffffff) used to return "4294967295" but now returns "0004294967295"; however, I couldn't understand why this was only happening with ASan/MSan. I tried to look at the libcxx implementation of how this works and it seems like it should only EVER return "0004294967295". Looking at the implementation of __itoa::__u64toa(), the logic for handling 9-12 digits seems incorrect, it will always add additional zeroes: for the number above b0=0 c0=42 so it runs append1 "0" append4 "0042" append4 "9496" append4 "7295".

I tried doing a local non-ASan build and building a trivial test program that does std::to_string((uint64_t)4294967295) and it gives the expected incorrect result so I guess the other bots are just not building the tests with libc++.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59178/new/

https://reviews.llvm.org/D59178





More information about the libcxx-commits mailing list