DJGPP - compiler error?
Posted: Thu Apr 13, 2006 5:50 am
I've found something that I don't understand
This is C code
and here is what i get after compiling with -S option
Problem is with lines
First line is doing something like SS:[EBP + 8] -> EAX
and second one is doing 9 -> DS:[EAX]. Problems arise when argument of fun2 is on stack and DS != SS.
Because movl $9, (%eax) will copy data to DS:[EAX] instead of SS:[EAX]
Is it just my imagination, lack of knowledge or is it bug in djgpp compiler?
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?