bug with __fastcall and another with disassembler

Started by tormoz, September 10, 2005, 01:17:31 PM

Previous topic - Next topic

tormoz

This program crashes after run

int __fastcall fun(int a,int b,int c,int d,int e){
   return 0;
}

int main(){
   fun(0,0,0,0,0);
   return 0;
}

if you look at fun code in disassembler you will see what's the reason. The "ret" command is wrong (like for __stdcall but not like for __fastcall for this example "ret 14" instead "ret C"). It brokes the stack!

Another bug is that in disassembler negative integer numbers show incorrectly. For example "-FF" instead "-1"

And it will be good if you will use more registers for __fastcall calling.

Pelle

Quote from: "tormoz"This program crashes after run

int __fastcall fun(int a,int b,int c,int d,int e){
   return 0;
}

int main(){
   fun(0,0,0,0,0);
   return 0;
}
Yes, it was a problem with unreferenced parameters. Pretty uncommon for fastcall functions, I would think.

Quote from: "tormoz"
Another bug is that in disassembler negative integer numbers show incorrectly. For example "-FF" instead "-1"
This is by design and not a bug.

Quote from: "tormoz"
And it will be good if you will use more registers for __fastcall calling.
Impossible.

Pelle
/Pelle


tormoz

Quote from: "Pelle"
Quote from: "tormoz"
And it will be good if you will use more registers for __fastcall calling.
Impossible.
Sorry,

I meant that it will be good to make faster calling conversion (something like Register Based Calling in Watcom Compiler) but it's another topic and brunch in forum.

Pelle

OK - yes, maybe useful. The best code is usually produced when the compiler may choose registers by itself (without restrictions). It's harder to produce good code for fastcall functions, than for stdcall functions, for example...

Pelle
/Pelle