When compiling with GCC4 the following error occurs.
lib/util/rbtree.c:140: undefined reference to `__builtin_uaddl_overflow'
This is because builtin_uaddl_overflow() and the other
builtin_u{add,mul}{,l,ll}_overflow() functions are only defined in
GNUC < 5 for Clang. When using GCC4 and below they are not defined.
Since the SZ_ADD_OV and SZ_MUL_OV are only used to check 'size_t' type
values. And overflow on add and multiply of unsigned types is defined
behaviour (C Standard 6.2.5 paragraph 9). It's simple to write overflow
functions for this specific case. These are based on the overflow
wrappers from the SEI CERT C Standard INT30-C.
When compiling with GCC4 the following error occurs.
This is because builtin_uaddl_overflow() and the other builtin_u{add,mul}{,l,ll}_overflow() functions are only defined in GNUC < 5 for Clang. When using GCC4 and below they are not defined.
Since the SZ_ADD_OV and SZ_MUL_OV are only used to check 'size_t' type values. And overflow on add and multiply of unsigned types is defined behaviour (C Standard 6.2.5 paragraph 9). It's simple to write overflow functions for this specific case. These are based on the overflow wrappers from the SEI CERT C Standard INT30-C.
[1] https://gcc.gnu.org/gcc-5/changes.html
Signed-off-by: Brandon Maier brandon.maier@rockwellcollins.com