Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2017-06

X64 only - Can't determine which overloaded function to call

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

James Richters

I have two almost identical programs, but one of them I cannot compile with Win64, but it works fine with Win32.

I finally figured out that the difference between the two that seemed to make a difference was the working one had constants defined, the one with issues, those constants were changed to variables.

I've managed to reduce it down to the offending line and made some test programs that demonstrate the issue:

This program runs fine with both Win32 and Win64:

Const
  BYA=5;
  SYA=10;
Var
  LY:word;
Begin
LY:=Round(30-(BYA+SYA));
End.

This program will only compile with Win32. With Win 64 I get:

testit.pas(7,5) Error: Can't determine which overloaded function to call.
Var
  LY:word;
  BYA,SYA:Byte;
Begin
BYA:=5;
SYA:=10;
LY:=Round(30-(BYA+SYA));    //This is the line producing the error, but why?
End.

I'm very confused by this. It's very clear what to do, and as far as I know, valid syntax.

If I use

LY:=Round(30-BYA-SYA);

Then it is compiled by both Win32 and Win64 fine. But this is not what I always want to do, I have reasons to want it (30-(BYA+SYA)) the original formula was very long, I reduced it down to this one thing that causes the problem, I really need to be able to group things the way I want to group them.

Strangely:

LY:=Round(30.1-(BYA+SYA));

Also compiles fine with both Win32 and Win64

I am compiling 32bit version with:

fpc testit.pas

And compilng 64bit verion with:

fpc -Px86_64 testit.pas

Any ideas about this?

James

Unknown author
to James Richters
James Richters wrote 5 lines
Strangely: LY:=Round(30.1-(BYA+SYA)); Also compiles fine with both Win32 and Win64

have you tried 30.0 as well? it looks like something needs a real number for this on the 64bit side...

NOTE: No off-list assistance is given without prior approval. *Please keep mailing list traffic on the list unless* *a signed and pre-paid contract is in effect with us.*
James Richters
to Unknown author
have you tried 30.0 as well? it looks like something needs a real number for this on the 64bit side...

I have just now tried 30.0 and it compiles and runs fine with x64.

I have also put the 30 back and changed the BYA and SYA variables to integers and it also works fine on x64.

I just stuck the 30 in there to demonstrate the problem, my original program has a function call where the 30 is that returns an integer. I realize that there is no possible reason to want to round this with the variables supplied, the round was left over because I used to have a divide in the formula but ended up removing it but never removed the round() Still, I think this should compile successfully (useless as it is) anyway because there is technically nothing wrong with it.

I can do Round(30), and Round(BYA) (BYA is a byte variable) successfully in both Win32 and Win64, so I don't know why this particular combination is a problem. I just now also tried

LY:=Round(-(BYA+SYA)+30);   //works both Win32 and Win64
Which is exactly the same thing as
LY:=Round(30-(BYA+SYA));   //Does not work Win64

James

Earlier message 19 lines
-----Original Message----- From: fpc-pascal On Behalf Of Sent: Thursday, June 15, 2017 2:03 PM To: Subject: Re: [fpc-pascal] X64 only - Can't determine which overloaded function to call On 06/15/2017 08:20 AM, James Richters wrote: > Strangely: > > LY:=Round(30.1-(BYA+SYA)); > > Also compiles fine with both Win32 and Win64 have you tried 30.0 as well? it looks like something needs a real number for this on the 64bit side... -- NOTE: No off-list assistance is given without prior approval. *Please keep mailing list traffic on the list unless* *a signed and pre-paid contract is in effect with us.* _______________________________________________