Mail Archives: djgpp/1994/10/12/23:25:33
I double checked, that I recompiled the libraries with the newest
tools of djgpp1.12m2. gas is version 2.3 which is the version
the file versions.doc says. The following program will
fail consistently. I think, this really is a gas bug, but, as I said
before, the documentation is not very clear about this. At one
place it says that gas would never use 16-bit jump instructions,
at an other place it says, that it was risky to use j[e]cxz.
I think it shouldn't be risky with short jumps.
Dieter
c:\tmp>type d.c
#include <stdio.h>
/* d uses 4*5 = 20 bytes of code memory */
#define d \
asm volatile("movl $0, %eax;movl $0, %eax;movl $0, %eax;movl $0, %eax;\n")
#define d8 d;d;d;d;d;d;d;d
#define d64 d8;d8;d8;d8;d8;d8;d8;d8
#define d256 d64;d64;d64;d64
#define d1024 d256;d256;d256;d256 /* uses 20k of code space */
int
main(void)
{
static volatile int t = 0;
/* uses at least 80k code space */
d1024;
d1024;
d1024;
d1024;
if (t)
{
printf("This should not be printed\n");
return 1;
}
t = 1;
asm volatile("xorl %%ecx, %%ecx\n"
"jcxz 1f\n" /* will not jump to correct location */
"1:\n" ::: "ecx");
printf("This will not be printed\n");
return 0;
}
c:\tmp>as -v < nul
GNU assembler version 2.3 (i386)
c:\tmp>gcc d.c
c:\tmp>go32 a.out
go32 version 1.12.maint2 Copyright (C) 1994 DJ Delorie
This should not be printed
c:\tmp>exit
- Raw text -