www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/04/27/07:32:08

Date: Thu, 27 Apr 1995 12:16:12 +0300
From: eliz AT is DOT elta DOT co DOT il (Eli Zaretskii)
To: A DOT APPLEYARD AT fs2 DOT mt DOT umist DOT ac DOT uk
Subject: Re: Gnu C++ odd event on divide by zero
Cc: DJGPP AT SUN DOT SOE DOT CLARKSON DOT EDU

> #include<stdio.h>
> main(){double x,y; x=0; y=1/x;}
>
> I just 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 when I ctrl-C'ed out of it, the resulting `hex' dump was this:-
>
> ====================
> Ctrl-C Hit!  Stopped at address 1c2
>
>   and nothing at all else. I have 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

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)?

Oh, and the Ctrl-C hit message comes from go32, not from your program
(signals aren't supported in v1.x), so it's normal to not have any stack
trace printed in that case.

- Raw text -


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