RTEMS | cpukit/dev/can/can-bittiming.c: Do not use abs() on unsigned values (!726)

Pavel Pisa (@ppisa) gitlab at rtems.org
Fri Sep 19 22:21:34 UTC 2025




Pavel Pisa commented on a discussion: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/726#note_132798


We can prepare another merge request if that is preferred way.

The problem and solutions I see are the same as above and which @michallenc has written there in parallel with me.

But I would give bold warning to fix warnings without full analysis such that they disappear. If there have been another abs warnings then they can and probably would lead to broken code. The original code worked well for all systems which define signed numbers by the second complement representation. May be that actual attempt to push implementation defined behavior to undefined one for the performance gain can broke results for now or in future. But simple warning silence can lead to broken code which is hard to find cause of the problems.

-- 
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/726#note_132798
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/20250919/7bc2926a/attachment.htm>


More information about the bugs mailing list