Closed DoctorWkt closed 4 months ago
This test program exhibits the behaviour but it goes away when I remove the static
keyword.
#include <stdio.h>
int main() {
static char gt[30];
char *p;
p= gt;
*p++ = 'W';
*p++ = 'K';
*p++ = 'T';
printf("p-gt is %d %x\n", (p-gt), (p-gt));
return(0);
}
And ... the same behaviour (static: bad, non-static: good) is exhibited by the 6809 backend as well as the Z80 backend. Hmm. I've made it test036 in Fuzemsys.
For some reason it generated printf("./..", gt, gt);
Not quite sure where the subtract went but I see the wrong code
Ok swapping the types to int works (but found another bug in the Z80 codegen which I've now fixed).
It only occurs if
It's present on all targets and the backend doesn't know the difference between the two declarations, so this is a bug in the compiler proper not the backend I think.
T_ARGCOMMA v0 t9 f0
T_ARGCOMMA v0 t10 f0
T_LABEL v0 t10 f0 gt
T_LABEL v0 t10 f0 gt
T_LABEL v0 t9 f0
T_NAME v0 t8000 f0 printf
Closed by 69e39601f8cded05099d25921b394f969b0ad4e4
Alan, I'm compiling
levee
with the z80 backend. Indisplay.c:mvcur()
there is this code which I've decorated:because I'm seeing this output from the
printf()
:It looks like the
(p-gt)
isn't producing the right Z80 assembly code.P.S. And if I change things to:
then things work fine.