egcs-20000925 code generation bug

Richard Zidlicky Richard.Zidlicky@stud.informatik.uni-erlangen.de
Sat Sep 30 14:04:00 GMT 2000


Hello,

the snapshot almost works for me, but fails on
this varargs like code:

/*
 *  oprintf  functional equivalent to printf that writes
 *           to output instead of stdout.
 */
/*PRINTFLIKE1 */
void oprintf (const char * formatstr)
{
    va_list ap;

    VA_START (ap, formatstr);
    vprint (output, formatstr, ap);
    va_end (ap);
}

# preprocessed to

void oprintf (const char * formatstr, ...)
{
    va_list ap;

    ((ap) = (va_list)&formatstr + ((sizeof(formatstr)+sizeof(int)-(size_t)1) & ~(sizeof(int) -(size_t)1)));
    vprint (output, formatstr, ap);
;
}

# produces this code:
_oprintf:
	pea 8(sp)
	move.l 4(sp),-(sp) # !!!! gcc lost track that previous
	                   # insn pushed the stack - needs be 8(sp) now
	move.l _output,-(sp)
	bsr _vprint
	lea 12(sp),sp
	rts
	
# for comparison code produced by 2.95.1, the link insn avoids all trouble
_oprintf:
	link a6,#0
	pea 12(a6)
	move.l 8(a6),-(sp)
	move.l _output,-(sp)
	bsr _vprint
	lea 12(sp),sp
	unlk a6
	rts

The code was generated with -O2 -fomit-frame-pointer in both cases.

The target is m68k-qdos which I should merge into official gcc
asap - how is that supposed to be done? 

Bye
Richard


More information about the Gcc mailing list