libstdc++: Make __from_chars_alnum_to_val conversion explicit
The optimizations from commit r12-8175-ga54137c88061c7 introduced a
clang integer sanitizer error.
Fix this with an explicit static_cast, similar to the fix for PR 96766.
libstdc++-v3/ChangeLog:
* include/std/charconv (__from_chars_alnum_to_val): Replace
implicit conversion from int to unsigned char with explicit
cast.
(cherry picked from commit 20ab397224
)
This commit is contained in:
parent
f3ff78e3db
commit
0bb30f94ac
@ -436,7 +436,7 @@ namespace __detail
|
|||||||
__from_chars_alnum_to_val(unsigned char __c)
|
__from_chars_alnum_to_val(unsigned char __c)
|
||||||
{
|
{
|
||||||
if _GLIBCXX17_CONSTEXPR (_DecOnly)
|
if _GLIBCXX17_CONSTEXPR (_DecOnly)
|
||||||
return __c - '0';
|
return static_cast<unsigned char>(__c - '0');
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// This initializer is deliberately made dependent in order to work
|
// This initializer is deliberately made dependent in order to work
|
||||||
|
Loading…
Reference in New Issue
Block a user