From bug-octave-request at bevo dot che dot wisc dot edu Wed Jul 14 12:31:18 1999 Subject: [jwe at bevo dot che dot wisc dot edu: Crashing after complex division by zero] From: craig at jcb-sc dot com To: bug-octave at bevo dot che dot wisc dot edu Date: Wed, 14 Jul 1999 12:31:10 -0500 (CDT) Enclosed is a bug report against libF77. I'm not sure how valid the complaint is, or what all the implications of making the recommended change are. I'm pretty sure we won't be making any g77-specific patches to libf2c (in what we call libg2c) anymore, except in specific instances, such as when we're pretty sure you're going to make the same bug-fix shortly anyway -- definitely not the case here! Also, I'll note that, as of gcc 2.95 aka g77 0.5.25, libg2c's c_div and z_div routines aren't used by default anymore. But they're still used if the user compiles with the `-Os' (optimize for space) option, so we're still interested in keeping them current vis-a-vis netlib libf2c. tq vm, (burley) ------- Start of forwarded message ------- Mailing-List: contact egcs-bugs-help at egcs dot cygnus dot com; run by ezmlm Precedence: bulk Sender: owner-egcs-bugs at egcs dot cygnus dot com From: "John W. Eaton" Content-Type: text/plain; charset=us-ascii Date: Wed, 14 Jul 1999 11:21:34 -0500 (CDT) To: Thomas Hoffmann Cc: bug-octave at bevo dot che dot wisc dot edu, egcs-bugs@egcs.cygnus.com Subject: Crashing after complex division by zero In-Reply-To: <199907141202 dot OAA07624 at ehmgs2 dot et dot tu-dresden dot de> X-UIDL: 54c7c006e30bc79c1a63b6b14c7950e7 [The following bug was reported for Octave 2.0.14, but it is really a problem with libg2c, so I'm also sending this report to the egcs-bug list. --jwe] On 14-Jul-1999, Thomas Hoffmann wrote: | Bug report for Octave 2.0.14 configured for hppa1.1-hp-hpux10.20 | | Description: | ----------- | octave:2> b=[0 i | > 0 0] | b = | | 0 + 0i 0 + 1i | 0 + 0i 0 + 0i | | octave:3> inv(b) | complex division by zero | Abort(coredump) | | Repeat-By: | --------- | | b=[0 i | > 0 0] | | inv(b) This problem is due to a bug in the complex division routine used by g77. The following patch will make it behave the same as the complex division code used by g++ (which was adapted from the libf2c code). The code in c_div.c is not relevant to Octave, but it has the same problem. To take advantage of this patch with Octave, you will have to recompile the libg2c library from egcs then relink Octave. Thanks, jwe Wed Jul 14 09:58:23 1999 John W. Eaton * libF77/z_div.c (z_div): Don't call sig_die for division by zero. * libF77/c_div.c (c_div): Likewise. *** egcs-1.1.2/libf2c/libF77/z_div.c 1999/07/14 14:54:15 1.1 - --- egcs-1.1.2/libf2c/libF77/z_div.c 1999/07/14 14:55:00 *************** *** 18,25 **** abi = - abi; if( abr <= abi ) { - - if(abi == 0) - - sig_die("complex division by zero", 1); ratio = b->r / b->i ; den = b->i * (1 + ratio*ratio); res.r = (a->r*ratio + a->i) / den; - --- 18,23 ---- *** egcs-1.1.2/libf2c/libF77/c_div.c 1999/07/14 14:54:19 1.1 - --- egcs-1.1.2/libf2c/libF77/c_div.c 1999/07/14 14:54:52 *************** *** 19,26 **** abi = - abi; if( abr <= abi ) { - - if(abi == 0) - - sig_die("complex division by zero", 1); ratio = (double)b->r / b->i ; den = b->i * (1 + ratio*ratio); res.r = (a->r*ratio + a->i) / den; - --- 19,24 ---- ------- End of forwarded message ------- --------------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. To ensure that development continues, see www.che.wisc.edu/octave/giftform.html Instructions for unsubscribing: www.che.wisc.edu/octave/archive.html ---------------------------------------------------------------------