This is the mail archive of the crossgcc@cygnus.com mailing list for the crossgcc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

possible 060 floating point bugs?



Each of the following lines of code will cause a Vector 11 (F-line) trap:
* Or just hang the processor because my fault handling code isn't
  the best in the world.

(the printf's don't count.)

#define	MAX(a, b)	a > b ? a : b

static short
check_floating_point(double x, float f, float a)
{
    short n;
    double ab = 0;		/* fails */
    if (x > 0)			/* fails */
        printf("Yep : x > 0\n");
    n = (short)f;		/* fails */
    n = (short) MAX(f, x);	/* fails */
    n = (short) MAX(n, a);	/* fails */
    return(n);
}

main()
{
    double d;
    float f, a;
    check_floating_point(d, f, a);
}

All of these work with 2.8 compiler, using 68040 codes.

When compiled for the 68060:

g++68k -fwritable-strings -fno-rtti -fno-exceptions \
    -c -g  -pipe -ansi  -Adebug\(on\) -D_G_NO_EXTERN_TEMPLATES \
    -DRTM -mshort -m68060 -DMC68060 -DMVP40 \
    -I../.././remote/include -I../.././remote/localinc \
    -I../.././remote/libinc \
    -I../.././remote/vcpu -I../.././remote/ppu -I../.././include/localinc \
    -I../.././include/libinc \
    main.c -o main.60

The code no longer works.

	-barto
-- 
David Barto	barto@network.ucsd.edu	barto@visionpro.com
>From a Marketing type:
    Don't give me any technical reason why something can't be done.
    If you really believed in the product you'd make it work.