Re: Divide by zero detection

George Neuner <>
Sat, 22 Sep 2007 13:08:33 -0400

          From comp.compilers

Related articles
Divide by zero detection ( (2007-09-18)
Re: Divide by zero detection (Hans-Peter Diettrich) (2007-09-20)
Re: Divide by zero detection (Alex Colvin) (2007-09-21)
Re: Divide by zero detection (George Neuner) (2007-09-22)
Re: Divide by zero detection (Gene) (2007-09-24)
| List of all articles for this month |

From: George Neuner <>
Newsgroups: comp.compilers
Date: Sat, 22 Sep 2007 13:08:33 -0400
Organization: Compilers Central
References: 07-09-074 07-09-078 07-09-081
Keywords: arithmetic, analysis
Posted-Date: 23 Sep 2007 18:58:46 EDT

On Fri, 21 Sep 2007 02:02:31 +0000 (UTC), Alex Colvin
<> wrote:

>>> I am looking for tools able to detect inside the source code,
>>> potential divide by zero errors.
>I think you're unlikely to find this in software, as it's one of the
>errors that is reliably and efficiently detected in hardware.

But the signal is not always caught by software. In languages with
optional handling the programmer can forget, and then there are those
languages in which it isn't even possible to catch the signal.

Depending on the local coding practices, the most workable idea is
probably the one Hans-Peter advanced: survey the source for divisions
that don't appear to handle the condition. The survey would only
produce a list of "probables" to be examined manually rather than a
list of definite bugs to be fixed. There are many ways a problem
division might be avoided altogether and frequently there are also
multiple ways to catch and handle the condition.


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.