|
|
Subscribe / Log in / New account

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

Oh, interesting. Is there any way to enable signal or some exception bit to detect this? (Like FP has, per standard)


to post comments

Division by zero

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.

Division by zero

Posted Jan 7, 2025 11:01 UTC (Tue) by paulj (subscriber, #341) [Link]

Hmm, ouch.

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.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds