Skip to content

[libc][build] gcc errors related to FP16 #122745

@Sh0g0-1758

Description

@Sh0g0-1758

After patching #122500, we ran into this new issue:

$ gcc --version | head -n1 
gcc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0
$ cmake ../runtimes -G Ninja -DLLVM_ENABLE_RUNTIMES="libc" -DCMAKE_BUILD_TYPE=Release -DLLVM_LIBC_FULL_BUILD=ON
$ ninja libc-unit-tests
[482/6748] Building CXX object libc/src/math/generic/CMakeFiles/libc.src.math.generic.sinf16.__NO_FMA_OPT.__NO_ROUND_OPT.__internal__.dir/sinf16.cpp.o
...
libc/src/math/generic/sinf16.cpp:58:41:   required from here
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;
      |                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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
...

cc: @nickdesaulniers @lntue

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions