<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/127139>127139</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[libc] -Winteger-overflow in scalblnl_test.cpp
</td>
</tr>
<tr>
<th>Labels</th>
<td>
libc
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
nickdesaulniers
</td>
</tr>
</table>
<pre>
```
In file included from /android0/llvm-project/libc/test/src/math/smoke/scalblnl_test.cpp:9:
In file included from /android0/llvm-project/libc/test/src/math/smoke/ScalbnTest.h:12:
/android0/llvm-project/libc/test/src/math/smoke/LdExpTest.h:53:63: warning: overflow in expression; result is -2'147'483'648 with type 'long' [-Winteger-overflow]
53 | long long_exp_array[4] = {LONG_MIN, INT_MIN - 1L, INT_MAX + 1L, LONG_MAX};
| ~~~~~~~~^~~~
/android0/llvm-project/libc/test/src/math/smoke/LdExpTest.h:53:49: warning: overflow in expression; result is 2'147'483'647 with type 'long' [-Winteger-overflow]
53 | long long_exp_array[4] = {LONG_MIN, INT_MIN - 1L, INT_MAX + 1L, LONG_MAX};
| ~~~~~~~~^~~~
/android0/llvm-project/libc/test/src/math/smoke/LdExpTest.h:53:63: warning: overflow in expression; result is -2'147'483'648 with type 'long' [-Winteger-overflow]
53 | long long_exp_array[4] = {LONG_MIN, INT_MIN - 1L, INT_MAX + 1L, LONG_MAX};
| ~~~~~~~~^~~~
/android0/llvm-project/libc/test/src/math/smoke/LdExpTest.h:53:49: warning: overflow in expression; result is 2'147'483'647 with type 'long' [-Winteger-overflow]
53 | long long_exp_array[4] = {LONG_MIN, INT_MIN - 1L, INT_MAX + 1L, LONG_MAX};
| ~~~~~~~~^~~~
```
This is with
`cmake ../runtimes -G Ninja -DLLVM_ENABLE_LLD=ON -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_RUNTIMES="libc" -DLIBC_TARGET_TRIPLE=i386-linux-gnu -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++`
i386 is ILP32 so `sizeof(int) == sizeof(long)`.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzsVk-PqzYQ_zTDZUQENn8PHCCQFSrJrvLy2u0JEXCI3zomsmH_9NDPXpmkeVVza_XeaZFlPB57fp7fjOVptOa9ZCwBPwM_t5ppPA4qkbx96ZhuJiE5U9raD91HAoFzbU5aSjxwwZDLVkwd6_CghhMCWTWyUwPvHCArIV5P9lkN31g7GpHvWyCrkWkjaWWEUzMejXAaXpj5t43YCylqs2jRns9A0xho-sMAvxhAuTNoR6CpSy5g_9ds1RXv55tVnwJNA9PhW6Mkl70ZDq9MHcTwhlwiez8rpjUfJNAMFdOTGJFrtAmQ0PVCIKEXUSBh4EX4xscjjh9nhkBCMcgeSIjgZ_ZvXI6sZ8r-2zT4OTgpIvoUIVyi-cyGuavZ-7lulGo-wM888HMEmiOEWfW4eajX5QbIEsvNzgzRRre6yekzAsmuM5fV6TOEOdDsAoc4w_15_cAvTP9DaPXi_0DrPavhJ6ufyfqZrD-B1X-8Ibsj18bD2Rujm9XtqXlhuFgAWalJjvzENNoPuOHyW4N2XlW_rutik2ZVUVdVDjR_3KCdL9fpL0WdfS2rvN79_lQAzbdMsEazf-3Zft3synXxBWgOhFziSMyaMlvWu3T7UOzq3bZ8qowJTqPAFlxO73YvpxvMsl4-rp_KqtgCzVvRyP676vn5TgkkM232GZzUGDVul9UTJagHhMDR_A82HIBEXI5AYhMHE4rb9CXGMQTOwuoS2sU0biyWuCGNvSig1LGOSeBHbeu5URhEQdREzO0CP4xJ15KDc4hoZPGEOMR3iEsJoZHvLIjvhd0hdL2YUIdSDzyHnRouFibbF4PqLa71xBKXhC6NLdHsmdBzpXBjztQMKplvx37qNXiO4HrU3y2MfBRzdTFv8HO8z1GT_XcvvzUpkRzH8azNk0xWQFY9H4_TftEOp-uFvL-X83k1kNX1yK8J-SsAAP__EnyvYQ">