www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/04/27/11:16:10

From: "A.Appleyard" <A DOT APPLEYARD AT fs2 DOT mt DOT umist DOT ac DOT uk>
To: eliz AT is DOT elta DOT co DOT il, DJGPP AT sun DOT soe DOT clarkson DOT edu
Date: Thu, 27 Apr 1995 13:13:06 BST
Subject: Re: Gnu C++ odd event on divide by zero

#include<stdio.h>
main(){double x,y; x=0; y=1/x;}

I ran the above small Gnu C++ program. Instead of any sort of useful fault
remark when it reached the divide-by-zero, it stuck (went into a tight
loop?), and I had to ctrl-C out of it.

  Eli Zaretski replied:-
> I've compiled and run this program under 1.12m4 (which is gcc 2.6.3 and
> libg++ 2.6.2), and it ran OK and printed ``Inf'' as a value of y (I added a
> printf at the end of the program). Seems OK to me. Time to upgrade? Or is it
> the effect of the printf() added (I didn't try without it)?

  Last night & today I got go32 1.12, binutils 2.4, bison 1.22, diffutils 2.6,
flex 2.4.7, gas 2.3, gcc 2.6.0, gdb 4.12, gzip 1.2.4, libg++-2.6.0, make-3.71,
patch-2.1, sed-1.18, texinfo-3.10, with maint updates DJ112M1/2/3/4.
  On my PC the above program, with and without `printf("%g\n",d);' inserted,
still sticks tight on running. But under Ladybug the version with the printf
seems to run OK and duly prints out `Inf'. PLEASE: does anyone out there know
of any combination of software that may make (divide-by-zero in a Gnu C++
program compiled by djgpp) act like this?

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019