RTEMS | libdl: Overflow in (#5557)
Joel Sherrill (@joel)
gitlab at rtems.org
Thu Apr 23 22:41:03 UTC 2026
Joel Sherrill created an issue: https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5557
Assignee: Chris Johns
## Summary
These macros in libdl generate an overflow warning. I am suspicious that since this code originated from NetBSD, it is most likely used primarily on 64-bit SPARCs and these warnings are on 32-bit SPARCs.
```
../../../cpukit/libdl/rtl-mdreloc-sparc.c:200:16: warning: overflow in conversion from 'long long unsigned int' to 'int' changes value from '4294967295' to '-1' [-Woverflow]
200 | #define _BM(x) (~(-(1ULL << (x))))
| ^
../../../cpukit/libdl/rtl-mdreloc-sparc.c:202:23: note: in expansion of macro '_BM'
202 | _BM(8), _BM(16), _BM(32), /* RELOC_8, _16, _32 */
| ^~~
../../../cpukit/libdl/rtl-mdreloc-sparc.c:200:16: warning: overflow in conversion from 'long long unsigned int' to 'int' changes value from '4294967295' to '-1' [-Woverflow]
200 | #define _BM(x) (~(-(1ULL << (x))))
| ^
../../../cpukit/libdl/rtl-mdreloc-sparc.c:203:23: note: in expansion of macro '_BM'
203 | _BM(8), _BM(16), _BM(32), /* DISP8, DISP16, DISP32 */
| ^~~
../../../cpukit/libdl/rtl-mdreloc-sparc.c:200:16: warning: overflow in conversion from 'long long unsigned int' to 'int' changes value from '4294967295' to '-1' [-Woverflow]
200 | #define _BM(x) (~(-(1ULL << (x))))
| ^
../../../cpukit/libdl/rtl-mdreloc-sparc.c:211:5: note: in expansion of macro '_BM'
211 | _BM(32) /* _UA32 */
| ^~~
```
## Steps to reproduce
Enable -_pendantic_ and disable _-Werror_.
<!-- Pre-set options
- milestone
-->
--
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5557
You're receiving this email because of your account on gitlab.rtems.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20260423/d1dca75d/attachment.htm>
More information about the bugs
mailing list