This is C code
Code: Select all
void fun2(int *arg)
{
*arg = 9;
}
Code: Select all
.globl fun2
fun2:
pushl %ebp
movl %esp, %ebp
movl 8(%ebp), %eax
movl $9, (%eax)
popl %ebp
ret
Code: Select all
movl 8(%ebp), %eax
movl $9, (%eax)
and second one is doing 9 -> DS:[EAX]. Problems arise when argument of fun2 is on stack and DS != SS.
Code: Select all
int main()
{
int arg;
fun2(&arg);
}
Is it just my imagination, lack of knowledge or is it bug in djgpp compiler?