Better handling of integer wraparound in the kernel
Better handling of integer wraparound in the kernel
Posted Jan 27, 2024 21:07 UTC (Sat) by donald.buczek (subscriber, #112892)In reply to: Better handling of integer wraparound in the kernel by ballombe
Parent article: Better handling of integer wraparound in the kernel
Sorry, I'm note sure, I understand that question? gcc understands `__builtin_add_overflow` since 5.1 (2015) and clang since 3.8 (2016) . Or is this a counter-argument, because using the builtin would make the code to much dependent on the compiler version and variant? True, but the proposed macros use the builtin, too. And for the purpose to support other compilers, it would be enough to use one level of macro with no change of function or even #define __builtin_add_overflow only for those compilers which don't provide it.
Posted Jan 27, 2024 23:30 UTC (Sat)
by ballombe (subscriber, #9523)
[Link]
Thanks. Most gcc builtin are CPU-specific. It seems these ones are an exception!
Better handling of integer wraparound in the kernel
