Related articles |
---|
Divide by zero detection qualitychecker@free.fr (news.club-internet.fr) (2007-09-18) |
Re: Divide by zero detection DrDiettrich1@aol.com (Hans-Peter Diettrich) (2007-09-20) |
Re: Divide by zero detection alexc@TheWorld.com (Alex Colvin) (2007-09-21) |
Re: Divide by zero detection gneuner2@comcast.net (George Neuner) (2007-09-22) |
Re: Divide by zero detection gene.ressler@gmail.com (Gene) (2007-09-24) |
From: | Hans-Peter Diettrich <DrDiettrich1@aol.com> |
Newsgroups: | comp.compilers |
Date: | Thu, 20 Sep 2007 12:27:01 +0200 |
Organization: | Compilers Central |
References: | 07-09-074 |
Keywords: | arithmetic, analysis, comment |
Posted-Date: | 20 Sep 2007 21:37:20 EDT |
news.club-internet.fr wrote:
> I am looking for tools able to detect inside the source code,
> potential divide by zero errors. Does it exist. For what languages,
> what platform ? Thanks for your help
What's wrong with this approach:
1) find all divisions
2) exclude those with a constant non-zero right hand side
The interpretation of "division" and "non-zero RHS" depends on your
language.
Optionally:
3) exclude those with a preceding check for a non-zero RHS
4) exclude those with a handled zero-divide error
Again "check" and "handled" depends on your language.
DoDi
[You can do better than that, e.g.
a = 42;;
...
b = c/a;
No zero divide there, either. Doing the analysis properly is doubtless
undecidable, but with aggressive dataflow analysis you should be able to
rule out a lot of known non-zero divisors. -John]
Return to the
comp.compilers page.
Search the
comp.compilers archives again.