Cynerd opened a new pull request, #18480:
URL: https://github.com/apache/nuttx/pull/18480
## Summary
The truncl implementation expects 80 bit little endian representation of the
floating point number. That is valid for x86 but not for example arm. On arm
long double is the same as double.
This was discovered with newer version of GCC (15.2.0) that started emitting
warning:
```
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]
```
## Impact
This is technically a fix for `truncl` on platforms that have `long double`
of the same size as `double`, as the logic was correct only for 80 bit float.
## Testing
The testing was performed only by compilation, as the implementation just
redirects to the `trunc` instead. The warning disappeared with the changes made
in this PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]