This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


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

19990328 snapshot has problem loading FP constant on sparc


I bootstraped egcs-19990328 on sparc-sun-solaris2.5.1, no problem
(except that it wouldn't "make -j bootstrap", but I don't want to get
into that here).

The following code doesn't compile correctly with

gcc -g -fPIC -O1 -mcpu=supersparc -mtune=ultrasparc -c -o routines.o routines.c

It seems to be a problem with loading FP constants.  When it loads the 1.
for the call to atan, the assembly reads

	sethi	%hi(.LLC80), %o0
	or	%o0, %lo(.LLC80), %o0
	ld	[%l7+%o0], %o0
	call	atan, 0
	ldd	[%o0], %o0

which seems OK.  When it loads .5 the first time, it generates

	sethi	%hi(.LLC81), %o0
	or	%o0, %lo(.LLC81), %o0
	ld	[%l7+%o0], %o0
	ldd	[%o0], %f2

which again seems OK, but when it loads .5 the second and third times, it does

	sethi	%hi(.LLC81), %o0
	ldd	[%o0+%lo(.LLC81)], %f2

which doesn't seem right.  This is where it bombs with SIGBUS.

Sorry I don't have a shorter example.

Brad Lucier    lucier@math.purdue.edu

extern double cos(double);
extern double sin(double);
extern double atan(double);

typedef struct ___processor_state_struct
{
    long *stack,
        *stack_base,
        *stack_limit,
        *stack_trip,
        *stack_break,
        *fp;
    long *heap,
        *heap_limit,
        *hp;
    long r[20],
         pc,
         temp1,
         temp2,
         temp3,
         temp4;
    int na,
        np;
    int intr_enabled,
        intr_flag[3];
    long glo_list_head,
         glo_list_tail;
    long handler_break,
         handler_stack_limit,
         handler_heap_limit, handler_not_proc,
         handler_not_proc_glo, handler_wrong_nargs,
         handler_get_rest, handler_get_key,
         handler_get_key_rest, handler_force,
         handler_clam_conv_error, handler_cdef_conv_error,
         handler_return_to_c, initial_continuation;
    long executable_wills,
         non_executable_wills;
    ___jmpbuf_struct *catcher;
}                         ___processor_state_struct, *___processor_state;

static long ___H_makect(___processor_state ___ps)
{
    register long ___pc,
         ___temp;
    register unsigned long long ___temp64;
    register long ___start = ___lp + ((28) * 4 * (1 << 2));
    register long *___hp;
    register long *___fp;
    register long ___r0;
    register long ___r1;
    register long ___r2;
    register long ___r3;
    register long ___r4;
    register long ___r5;
    register long ___r7;
    double ___F64R1;
    double ___F64R4;
    double ___F64R5;
    double ___F64R6;
    double ___F64R7;
    ___hp = ___ps->hp;
    ___fp = ___ps->fp;
    ___r0 = ___ps->r[0];
    ___r1 = ___ps->r[1];
    ___r2 = ___ps->r[2];
    ___r3 = ___ps->r[3];
    ___r4 = ___ps->r[4];
    ___r5 = ___ps->r[5];
    ___r7 = ___ps->r[7];
    ___pc = ___ps->pc;
___jump:switch ((___pc -= ___start) / (4 * (1 << 2)))
    {
      case 28 - 28 + 0:
___L0_makect:
	if (___ps->na == 3)
	{
	}
	else
	{
	    ___ps->temp1 = ___start + ((28 - 28 + 0) * 4 * (1 << 2));
	    {
		___pc = ___ps->handler_wrong_nargs;
		goto ___jumpext;
	    }
	}
___L_makect:
	*(long *) (((long) (((long *) (___r2 - 1)) + 1)) + ((((long) (1L) << 2)) << (2 - 2))) = ___r1;
	if (!(___r1 > ((long) (1L) << 2)))
	{
	    goto ___L3_makect;
	}
	___r2 = (((___r1 >> (((long) (1L) << 2) >> 2)) & ~((1 << 2) - 1)));
	___F64R4 = (___r2 >> 2);
	___F64R5 = atan(1.);
	___F64R4 = (___F64R5 / ___F64R4);
	___F64R5 = (___r2 >> 2);
	___F64R5 = (___F64R4 * ___F64R5);
	___F64R5 = cos(___F64R5);
	*(double *) (((long) (((long *) (___r3 - 1)) + 1)) + ((((long) (0L) << 2)) << (3 - 2))) = ___F64R5;
	___F64R5 = *(double *) (((long) (((long *) (___r3 - 1)) + 1)) + ((((long) (0L) << 2)) << (3 - 2)));
	___F64R5 = (.5 * ___F64R5);
	*(double *) (((long) (((long *) (___r3 - 1)) + 1)) + ((___r2) << (3 - 2))) = ___F64R5;
	___r4 = ((___hp += 2 + 2, ((long) ___hp & 7) == 0 ? (*(___hp - 2 - 1) = (((2 << 2) << (3 + 5)) + (30 << 3) + 0), *(double *) ((___hp - 2 - 1) + 1) = ___F64R4, ((long) (___hp - 2 - 1) + 1)) : (*(___hp - 2 - 2) = (((2 << 2) << (3 + 5)) + (30 << 3) + 0), *(double *) ((___hp - 2 - 2) + 1) = ___F64R4, ((long) (___hp - 2 - 2) + 1))));
	___fp[-(1)] = (___r4);
	___r4 = (___r3);
	___r3 = (___r2);
	___r2 = (___r1);
	___r1 = (___fp[-(1)]);
	___r5 = (((long) (1L) << 2));
	if (___hp > ___ps->heap_limit)
	{
	    ___ps->temp1 = ___start + ((28 - 28 + 1) * 4 * (1 << 2));
	    {
		___pc = ___ps->handler_heap_limit;
		goto ___jumpext;
	    }
	}
      case 28 - 28 + 1:
___L1_makect:
	if ((___r5 == ___r3))
	{
	    goto ___L3_makect;
	}
___L2_makect:
	___F64R6 = (___r5 >> 2);
	___F64R1 = (*(double *) ((((long *) (___r1 - 1)) + 1)));
	___F64R6 = (___F64R1 * ___F64R6);
	___F64R7 = cos(___F64R6);
	___F64R7 = (.5 * ___F64R7);
	*(double *) (((long) (((long *) (___r4 - 1)) + 1)) + ((___r5) << (3 - 2))) = ___F64R7;
	___r7 = (((long) (___r2 - ___r5)));
	___F64R6 = sin(___F64R6);
	___F64R6 = (.5 * ___F64R6);
	*(double *) (((long) (((long *) (___r4 - 1)) + 1)) + ((___r7) << (3 - 2))) = ___F64R6;
	___r5 = (((long) (___r5 + ((long) (1L) << 2))));
	if (!(___r5 == ___r3))
	{
	    goto ___L2_makect;
	}
___L3_makect:
	___r1 = ((((long) -5 << 2) + 2));
	{
	    ___pc = ___r0;
	    goto ___jump;
	}
    } ___pc += ___start;
___jumpext:
    ___ps->pc = ___pc;
    ___ps->hp = ___hp;
    ___ps->r[1] = ___r1;
    ___ps->r[2] = ___r2;
    ___ps->r[3] = ___r3;
    ___ps->r[4] = ___r4;
    ___ps->r[5] = ___r5;
    ___ps->r[7] = ___r7;
    return ___pc;
}


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