[gnu.gcc.bug] GNU C bug report

phil@DECWRL.DEC.COM (Phil Hochstetler) (07/14/89)

Version of GNU CC:	gcc version 1.35
Input file:

#ifdef	COMMENT
In GNU C on Symmetry, converting an unsigned quantity to a float/double, if
the high bit in that quantity is set, causes a floating exception.
#endif

main()
{
	unsigned t;
	double x;

	t = 2400000000;
	x = t;
	printf("%f\n",x);
}

Compiled via:		gcc -o foo foo.c
tm.h and md file:	md -> config/i386.md
			tm.h -> config/tm-seq386.h
type of machine:	Sequent SYMMETRY
OS name and version:	DYNIX(R) V3.0.15
Bad behavior:		Running compiled program gets a
			floating point exception.

phil@DECWRL.DEC.COM (Phil Hochstetler) (07/14/89)

Version of GNU CC:	gcc version 1.35
Input file:

#ifdef	COMMENT
When GNU C compiles the following program on the Symmetry, the resulting
executable core dumps in the printf:

According to the originator of this bug (which has since been fixed on 
PCC and ATS CC) the incorrect code is generated since "the trunc instruction
connot convert a number greater than the signed maximum." (At least that's
what it happened on those two compilers.
#endif

/* 04521.c - make sure that this program doesn't bomb on the printf
 * dmose  7/13/89
 */

#include <stdio.h>

main()
{
	double d;
	unsigned bogus = 1;

	d = ((double) bogus);
	printf("%e\n", d);	/*works*/
	fflush();
	printf("%e\n", ((double) bogus));	/*core dumps in printf*/
}

Compiled via:		gcc -o foo foo.c
tm.h and md file:	md -> config/i386.md
			tm.h -> config/tm-seq386.h
type of machine:	Sequent SYMMETRY
OS name and version:	DYNIX(R) V3.0.15
Bad behavior:		Running compiled program gets a
			floating point exception in printf.