Skip to content

[libc] Enabling LIBC_MATH_INTERMEDIATE_COMP_IN_FLOAT breaks the 32-bit baremetal build #163711

@petrhosek

Description

@petrhosek

We tried to enable LIBC_MATH_INTERMEDIATE_COMP_IN_FLOAT for baremetal in #163622 but it broke the build with the following error:

/b/s/w/ir/x/w/llvm_build/./bin/clang++ --target=armv6m-none-eabi -DLIBC_NAMESPACE=__llvm_libc_22_0_0_git -I/b/s/w/ir/x/w/llvm-llvm-project/libc -isystem /b/s/w/ir/x/w/llvm_build/include/armv6m-unknown-none-eabi --target=armv6m-none-eabi -Wno-atomic-alignment "-Dvfprintf(stream, format, vlist)=vprintf(format, vlist)" "-Dfprintf(stream, format, ...)=printf(format)" "-Dfputs(string, stream)=puts(string)" -D_LIBCPP_PRINT=1 -mthumb -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wno-pass-failed -Wmisleading-indentation -Wctad-maybe-unsupported -ffunction-sections -fdata-sections -ffile-prefix-map=/b/s/w/ir/x/w/llvm_build/runtimes/runtimes-armv6m-none-eabi-bins=../../../llvm-llvm-project -ffile-prefix-map=/b/s/w/ir/x/w/llvm-llvm-project/= -no-canonical-prefixes -Os -DNDEBUG -std=gnu++17 --target=armv6m-none-eabi -DLIBC_QSORT_IMPL=LIBC_QSORT_HEAP_SORT -DLIBC_TYPES_TIME_T_IS_32_BIT "-DLIBC_MATH=(LIBC_MATH_SKIP_ACCURATE_PASS | LIBC_MATH_SMALL_TABLES | LIBC_MATH_INTERMEDIATE_COMP_IN_FLOAT)" -DLIBC_ERRNO_MODE=LIBC_ERRNO_MODE_EXTERNAL -DLIBC_THREAD_MODE=LIBC_THREAD_MODE_SINGLE -DLIBC_TARGET_OS_IS_BAREMETAL -fpie -ffreestanding -DLIBC_FULL_BUILD -nostdlibinc -ffixed-point -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 -Wall -Wextra -Werror -Wconversion -Wno-sign-conversion -Wdeprecated -Wno-c99-extensions -Wno-gnu-imaginary-constant -Wno-pedantic -Wimplicit-fallthrough -Wwrite-strings -Wextra-semi -Wnewline-eof -Wnonportable-system-include-path -Wstrict-prototypes -Wthread-safety -Wglobal-constructors -DLIBC_COPT_PUBLIC_PACKAGING -UNDEBUG -MD -MT libc/src/math/generic/CMakeFiles/libc.src.math.generic.atan2f.dir/atan2f.cpp.obj -MF libc/src/math/generic/CMakeFiles/libc.src.math.generic.atan2f.dir/atan2f.cpp.obj.d -o libc/src/math/generic/CMakeFiles/libc.src.math.generic.atan2f.dir/atan2f.cpp.obj -c /b/s/w/ir/x/w/llvm-llvm-project/libc/src/math/generic/atan2f.cpp
 In file included from /b/s/w/ir/x/w/llvm-llvm-project/libc/src/math/generic/atan2f.cpp:10:
 In file included from /b/s/w/ir/x/w/llvm-llvm-project/libc/src/__support/math/atan2f.h:16:
 /b/s/w/ir/x/w/llvm-llvm-project/libc/src/__support/FPUtil/double_double.h:83:13: error: implicit conversion loses floating-point precision: 'double' to 'float' [-Werror,-Wimplicit-float-conversion]
    83 |   r.hi = t1 + t2;
       |        ~ ~~~^~~~
 /b/s/w/ir/x/w/llvm-llvm-project/libc/src/__support/FPUtil/double_double.h:139:24: note: in instantiation of function template specialization '__llvm_libc_22_0_0_git::fputil::split<float, 12U>' requested here
   139 |     NumberPair<T> as = split(a);
       |                        ^
 /b/s/w/ir/x/w/llvm-llvm-project/libc/src/__support/math/atan2f_float.h:223:30: note: in instantiation of function template specialization '__llvm_libc_22_0_0_git::fputil::exact_mult<float, 12U>' requested here
   223 |   FloatFloat num_k = fputil::exact_mult(num, k);
       |                  

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions