Skip to content

[libc] -Winteger-overflow in scalblnl_test.cpp #127139

Open
@nickdesaulniers

Description

@nickdesaulniers
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).

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions