Issue |
120427
|
Summary |
[libc] gcc build errors about conversion from 'int' to 'short unsigned int'
|
Labels |
libc
|
Assignees |
|
Reporter |
jackhong12
|
I built libc with g++ 13.3.0 and got the following errors.
```
[112/742] Building CXX object projects/libc/src/math/generic/CMakeFiles/libc.src.math.generic.sinf16.dir/sinf16.cpp.o
FAILED: projects/libc/src/math/generic/CMakeFiles/libc.src.math.generic.sinf16.dir/sinf16.cpp.o
/usr/bin/c++ -DLIBC_NAMESPACE=__llvm_libc_20_0_0_git -I/home/jack/open-source/llvm-project/build_gcc/projects/libc/src/math/generic -I/home/jack/open-source/llvm-project/libc/src/math/generic -I/home/jack/open-source/llvm-project/libc -isy
stem /home/jack/open-source/llvm-project/build_gcc/projects/libc/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -fno-lifetime-dse -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno
-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-overrid
e -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -std=c++17 -mavx2 -mfma -msse4.2 -D__LIBC_USE_BUILTIN_CEIL_FLOOR_RINT_TRUNC -DLIBC_QSORT_IMPL=LIBC_QSO
RT_QUICK_SORT -DLIBC_ADD_NULL_CHECKS -fpie -fno-builtin -fno-exceptions -fno-lax-vector-conversions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -ftrivial-auto-var-init=pattern -fno-omit-frame-pointer -mno-omit-leaf-frame-p
ointer -Wall -Wextra -Werror -Wconversion -Wno-sign-conversion -fext-numeric-literals -Wno-pedantic -Wimplicit-fallthrough -Wwrite-strings -Wextra-semi -O3 -DLIBC_COPT_PUBLIC_PACKAGING -MD -MT projects/libc/src/math/generic/CMakeFiles/libc
.src.math.generic.sinf16.dir/sinf16.cpp.o -MF projects/libc/src/math/generic/CMakeFiles/libc.src.math.generic.sinf16.dir/sinf16.cpp.o.d -o projects/libc/src/math/generic/CMakeFiles/libc.src.math.generic.sinf16.dir/sinf16.cpp.o -c /home/jac
k/open-source/llvm-project/libc/src/math/generic/sinf16.cpp
In file included from /home/jack/open-source/llvm-project/libc/src/math/generic/sinf16.cpp:16:
/home/jack/open-source/llvm-project/libc/src/__support/FPUtil/except_value_utils.h: In instantiation of ‘constexpr __llvm_libc_20_0_0_git::cpp::optional<T> __llvm_libc_20_0_0_git::fputil::ExceptValues<T, N>::lookup_odd(StorageType, bool) c
onst [with T = _Float16; long unsigned int N = 4; StorageType = short unsigned int]’:
/home/jack/open-source/llvm-project/libc/src/math/generic/sinf16.cpp:58:41: required from here
/home/jack/open-source/llvm-project/libc/src/__support/FPUtil/except_value_utils.h:84:20: error: conversion from ‘int’ to ‘__llvm_libc_20_0_0_git::fputil::ExceptValues<_Float16, 4>::StorageType’ {aka ‘short unsigned int’} may change value
[-Werror=conversion]
84 | out_bits += sign ? values[i].rnd_downward_offset
| ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
85 | : values[i].rnd_upward_offset;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/jack/open-source/llvm-project/libc/src/__support/FPUtil/except_value_utils.h:88:20: error: conversion from ‘int’ to ‘__llvm_libc_20_0_0_git::fputil::ExceptValues<_Float16, 4>::StorageType’ {aka ‘short unsigned int’} may change value
[-Werror=conversion]
88 | out_bits += sign ? values[i].rnd_upward_offset
| ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
89 | : values[i].rnd_downward_offset;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
[124/742] Building CXX object projects/libc/src/math/generic/CMakeFiles/libc.src.math.generic.tanpif16.dir/tanpif16.cpp.o
FAILED: projects/libc/src/math/generic/CMakeFiles/libc.src.math.generic.tanpif16.dir/tanpif16.cpp.o
/usr/bin/c++ -DLIBC_NAMESPACE=__llvm_libc_20_0_0_git -I/home/jack/open-source/llvm-project/build_gcc/projects/libc/src/math/generic -I/home/jack/open-source/llvm-project/libc/src/math/generic -I/home/jack/open-source/llvm-project/libc -isystem /home/jack/open-source/llvm-project/build_gcc/projects/libc/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -fno-lifetime-dse -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -std=c++17 -mavx2 -mfma -msse4.2 -D__LIBC_USE_BUILTIN_CEIL_FLOOR_RINT_TRUNC -DLIBC_QSORT_IMPL=LIBC_QSORT_QUICK_SORT -DLIBC_ADD_NULL_CHECKS -fpie -fno-builtin -fno-exceptions -fno-lax-vector-conversions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -ftrivial-auto-var-init=pattern -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wall -Wextra -Werror -Wconversion -Wno-sign-conversion -fext-numeric-literals -Wno-pedantic -Wimplicit-fallthrough -Wwrite-strings -Wextra-semi -O3 -DLIBC_COPT_PUBLIC_PACKAGING -MD -MT projects/libc/src/math/generic/CMakeFiles/libc.src.math.generic.tanpif16.dir/tanpif16.cpp.o -MF projects/libc/src/math/generic/CMakeFiles/libc.src.math.generic.tanpif16.dir/tanpif16.cpp.o.d -o projects/libc/src/math/generic/CMakeFiles/libc.src.math.generic.tanpif16.dir/tanpif16.cpp.o -c /home/jack/open-source/llvm-project/libc/src/math/generic/tanpif16.cpp
In file included from /home/jack/open-source/llvm-project/libc/src/math/generic/tanpif16.cpp:16:
/home/jack/open-source/llvm-project/libc/src/__support/FPUtil/except_value_utils.h: In instantiation of ‘constexpr __llvm_libc_20_0_0_git::cpp::optional<T> __llvm_libc_20_0_0_git::fputil::ExceptValues<T, N>::lookup_odd(StorageType, bool) const [with T = _Float16; long unsigned int N = 21; StorageType = short unsigned int]’:
/home/jack/open-source/llvm-project/libc/src/math/generic/tanpif16.cpp:52:45: required from here
/home/jack/open-source/llvm-project/libc/src/__support/FPUtil/except_value_utils.h:84:20: error: conversion from ‘int’ to ‘__llvm_libc_20_0_0_git::fputil::ExceptValues<_Float16, 21>::StorageType’ {aka ‘short unsigned int’} may change value [-Werror=conversion]
84 | out_bits += sign ? values[i].rnd_downward_offset
| ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
85 | : values[i].rnd_upward_offset;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/jack/open-source/llvm-project/libc/src/__support/FPUtil/except_value_utils.h:88:20: error: conversion from ‘int’ to ‘__llvm_libc_20_0_0_git::fputil::ExceptValues<_Float16, 21>::StorageType’ {aka ‘short unsigned int’} may change value [-Werror=conversion]
88 | out_bits += sign ? values[i].rnd_upward_offset
| ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
89 | : values[i].rnd_downward_offset;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs