{bp-19242} Long double macros#19278
Merged
Merged
Conversation
acassis
approved these changes
Jul 2, 2026
linguini1
approved these changes
Jul 2, 2026
cederom
approved these changes
Jul 2, 2026
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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