Division by zero
Division by zero
Posted Jan 6, 2025 15:52 UTC (Mon) by paulj (subscriber, #341)In reply to: Division by zero by pm215
Parent article: Preventing data races with Pony
Posted Jan 6, 2025 17:39 UTC (Mon)
by farnz (subscriber, #17727)
[Link] (1 responses)
Not for the integer UDIV and SDIV instructions. You can see in the "Operation" section (which uses Arm Pseudocode to describe the behaviour in abstract terms) that the instruction unconditionally outputs a 0 result if the input divisor is 0.
Posted Jan 7, 2025 11:01 UTC (Tue)
by paulj (subscriber, #341)
[Link]
GCC seems to have some useful options to help catch int-div-0 in testing, including for its analyzer and sanitizer, and also a -mcheck-zero-division - which is enabled by default for -O0 and -Og.
Division by zero
Division by zero