Skip to content

{bp-19242} Long double macros#19278

Merged
xiaoxiang781216 merged 3 commits into
apache:releases/13.0from
jerpelea:bp-19242
Jul 3, 2026
Merged

{bp-19242} Long double macros#19278
xiaoxiang781216 merged 3 commits into
apache:releases/13.0from
jerpelea:bp-19242

Conversation

@jerpelea

@jerpelea jerpelea commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Summary

This fixes the issue discovered with a new versions of GCC:

libm/lib_truncl.c: In function 'truncl':
libm/lib_truncl.c:68:14: error: 'u.i.se' is used uninitialized [-Werror=uninitialized]
68 | int e = u.i.se & 0x7fff;
| ~~~^~~
libm/lib_truncl.c:63:17: note: 'u' declared here
63 | union ldshape u =
| ^
libm/lib_truncl.c:69:14: error: 'u.i.se' is used uninitialized [-Werror=uninitialized]
69 | int s = u.i.se >> 15;
| ~~~^~~
libm/lib_truncl.c:63:17: note: 'u' declared here
63 | union ldshape u =
| ^
libm/lib_truncl.c:63:17: error: 'u.i.se' is used uninitialized [-Werror=uninitialized]

This was originally submitted in #18480, but that failed to approach the missing long double definitions.

Impact

RELEASE

Testing

CI

@github-actions github-actions Bot added Area: OS Components OS Components issues Size: M The size of the change in this PR is medium labels Jul 2, 2026
Cynerd added 3 commits July 2, 2026 17:23
This addresses "FIX ME" definitions for the long double. These might not
be all long double format supported by NuttX.

The support was also added only for GCC alike compilers. Other compilers
that have CONFIG_HAVE_LONG_DOUBLE defined will fail with error that
mantisage digits have to be defined for that compiler.

Signed-off-by: Karel Kočí <kkoci@elektroline.cz>
NuttX defines constants for the sizes of types just as constants
directly in the code. The real values depend on compiler and target
platform. It is possible that value declared by NuttX header is wrong
compared to the compiler configuration. This is more likely in case of
floating points.

Not all compilers supported by NuttX provide required info through
defines and thus it is more generic to specify limits as constants, but
in case compiler provides them then it is a good idea to compare. This
commit adds such set of comparisons for limits.h and float.h constants.

The comparisons were tested with GCC and Clang. They will be ignored in
case compiler doesn't provide them.

Signed-off-by: Karel Kočí <kkoci@elektroline.cz>
This reuses implementation of trunc in case long double has same size as
double.

The previous implementation is used only in case x87 80-bit float point
is the long double. In other cases the logic is intentionally replaced
with panic to not provide a wrong result.

Signed-off-by: Karel Kočí <kkoci@elektroline.cz>
@xiaoxiang781216 xiaoxiang781216 merged commit e375b69 into apache:releases/13.0 Jul 3, 2026
22 of 41 checks passed
@jerpelea jerpelea deleted the bp-19242 branch July 3, 2026 06:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: OS Components OS Components issues Size: M The size of the change in this PR is medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants