Closed as not planned
Closed as not planned
Copy link
Description
Bugzilla Link | 31994 |
Version | trunk |
OS | Linux |
Extended Description
#include <string>
std::string foo() {
return std::to_string(5u);
}
$ clang++ -S -O3 -std=c++14
foo[abi:cxx11](): # @foo[abi:cxx11]()
push rbx
mov rbx, rdi
mov esi, vsnprintf
mov edx, 16
mov ecx, .L.str
mov r8d, 5
xor eax, eax
call __gnu_cxx::__to_xstring(int (*)(char*, unsigned long, char const*, __va_list_tag*), unsigned long, char const*, ...)
mov rax, rbx
pop rbx
ret
There was a post on the libstdc++ mailing list about this some time ago. They recommended better optimization of the vsnprintf builtin:
https://gcc.gnu.org/ml/libstdc++/2015-01/msg00007.html
When using the specialized to_string implementation from VisualC's STL gcc and clang are perfectly able to figure out the string constant.
Metadata
Metadata
Assignees
Labels
Issues migrated from bugzillaIssues migrated from bugzillaResolved as invalid, i.e. not a bugResolved as invalid, i.e. not a bugGNU libstdc++ C++ standard libraryGNU libstdc++ C++ standard library