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.