| |||
| Home > Compiler Coding Practices > Integer division-by-zero errors in C code | |||
You can trap and identify integer division-by-zero errors by re-implementing the appropriate C library helper functions.
The run-time divide routines have weak references to __aeabi_idiv0().
If __aeabi_idiv0() is not defined, then the
reference is ignored and the divide routines return zero.
If you provide your own version of __aebi_idiv0(),
then the divide routines call this function. The default library
version of __aeabi_idiv0() calls __rt_raise() to
raise SIGFPE with type DIVBYZERO.