LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 46016 - std::to_chars generates exception code
Summary: std::to_chars generates exception code
Status: CONFIRMED
Alias: None
Product: libc++
Classification: Unclassified
Component: All Bugs (show other bugs)
Version: 10.0
Hardware: All All
: P enhancement
Assignee: Marshall Clow (home)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-05-21 05:26 PDT by Hana Dusíková
Modified: 2020-05-21 07:34 PDT (History)
3 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Hana Dusíková 2020-05-21 05:26:27 PDT
`std::to_chars` is generating exception handling code, because internals functions are not marked `noexcept` and clang can't proof they won't throw:

```
namespace __itoa {
_LIBCPP_FUNC_VIS char* __u64toa(uint64_t __value, char* __buffer);
_LIBCPP_FUNC_VIS char* __u32toa(uint32_t __value, char* __buffer);
}
```

if you add `noexcept` there it will generate more efficient code:

https://compiler-explorer.com/z/H29awf
Comment 1 Louis Dionne 2020-05-21 07:34:02 PDT
https://reviews.llvm.org/D80379