<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/74623>74623</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[libc] -Wshift-count-overflow in libc/src/__support/UInt.h
</td>
</tr>
<tr>
<th>Labels</th>
<td>
code-quality,
libc
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
nickdesaulniers
</td>
</tr>
</table>
<pre>
```
[692/693] Building CXX object projects/libc/src/stdio/prin...s/libc.src.stdio.printf_core.converter.dir/converter.cpp.o
In file included from /android0/llvm-project/libc/src/__support/UInt128.h:12,
from /android0/llvm-project/libc/src/__support/FPUtil/FloatProperties.h:12,
from /android0/llvm-project/libc/src/__support/FPUtil/FPBits.h:17,
from /android0/llvm-project/libc/src/stdio/printf_core/core_structs.h:13,
from /android0/llvm-project/libc/src/stdio/printf_core/converter.h:12,
from /android0/llvm-project/libc/src/stdio/printf_core/converter.cpp:9:
/android0/llvm-project/libc/src/__support/UInt.h: In instantiation of ‘constexpr __llvm_libc_18_0_0_git::cpp::BigInt<Bits, Signed>::operator T() const [with T = unsigned int; <template-parameter-2-2> = void; long unsigned int Bits = 320; bool Signed = false]’:
/android0/llvm-project/libc/src/__support/float_to_string.h:381:57: required from here
/android0/llvm-project/libc/src/__support/UInt.h:125:53: warning: left shift count >= width of type [-Wshift-count-overflow]
125 | return static_cast<T>((static_cast<T>(val[1]) << 64) + lo);
| ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
```
I'm trying to get -Werror re-enabled in https://github.com/llvm/llvm-project/pull/74506; building with GCC flags the above warning.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8VU2P2zYQ_TXjy8CCRFpfBx_8sS58W6AbJDeBkiiZLU0q5MjbvfS3F6RtbJJuEbTZRjCsDw7nDd975Ajv1WikXEO-hXy_EDOdrFsb1f3eSy9mbZR0ftHa_mUNRXr7pXtIN5B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