www.delorie.com/djgpp/bugs/show.cgi   search  
Bug 000243

When Created: 07/27/1998 10:12:14
Against DJGPP version: 2.01
By whom: rudd@cyberoptics.com
Abstract: printf crashes when printing NaN
The following program crashes:

#include <stdio.h>
int main(void) {
   union {
      unsigned long long l;
      double d;
   } PNaN = {0x7FF8000000000000ll};
   printf("%E\n", PNaN.d);
   return 0;
}

I dug into doprnt.c in an attempt to find the cause. doprnt does a test to
determine the sign of the number, but does this before the test for NaN.
Unfortunately, the overall code structure seems complicated to me, and it looks
like a one-line patch will probably not be sufficient. I don't understand the
code well enough to be confident that I could fix the bug without breaking
something else. The author of the code should take a look at it, if possible.

Note added: 09/28/1998 14:00:11
By whom: rudd@cyberoptics.com
I tried the test program using the v2.02 libc.a, dated 98-09-07.  The problem
has apparently been fixed.

Solution added: 04/13/1999 12:00:51
By whom: eliz@is.elta.co.il
Solved in v2.02; upgrade.

Fixed in version on 04/13/1999 12:00:23
By whom: eliz@is.elta.co.il



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