Mon, 24 Sep 2007 04:16:10 -0000

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: | Gene <gene.ressler@gmail.com> |

Newsgroups: | comp.compilers |

Date: | Mon, 24 Sep 2007 04:16:10 -0000 |

Organization: | Compilers Central |

References: | 07-09-07407-09-078 |

Keywords: | arithmetic, errors, analysis |

On Sep 20, 6:27 am, Hans-Peter Diettrich <DrDiettri...@aol.com> wrote:

*> news.club-internet.fr wrote:*

*> > I am looking for tools able to detect inside the source code,*

*> > potential divide by zero errors. ...*

*>*

*> 1) find all divisions*

*> 2) exclude those with a constant non-zero right hand side*

*> Optionally:*

*>*

*> 3) exclude those with a preceding check for a non-zero RHS*

*> 4) exclude those with a handled zero-divide error ...*

*> [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]*

Yes! It's an interesting coincidence that there have been some

questions about abstract interpretation recently. This is the kind of

problem where it could apply. E.g. with a simple lattice over {-,

0,+}, you could pretty easily decide that

i = 20; while ... { a = 1.0 / i; ; ... ; i = i + 1; }

poses no danger and also that

i = -20; while ... { a = 1.0 / i; ... ; i = i + 1; }

does!

Post a followup to this message

Return to the
comp.compilers page.

Search the
comp.compilers archives again.