NO

Author Topic: bug with __fastcall and another with disassembler  (Read 3748 times)

tormoz

  • Guest
bug with __fastcall and another with disassembler
« on: September 10, 2005, 01:17:31 PM »
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.

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
Re: bug with __fastcall and another with disassembler
« Reply #1 on: September 10, 2005, 06:12:52 PM »
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

  • Guest
bug with __fastcall and another with disassembler
« Reply #2 on: September 10, 2005, 06:45:05 PM »
thanks

tormoz

  • Guest
Re: bug with __fastcall and another with disassembler
« Reply #3 on: September 10, 2005, 07:05:23 PM »
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.

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
bug with __fastcall and another with disassembler
« Reply #4 on: September 10, 2005, 08:32:14 PM »
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