View Issue Details

IDProjectCategoryView StatusLast Update
0036133FPCCompilerpublic2019-10-09 13:47
ReporterSkvoznjakAssigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
Platformx86_64OSWin64 bitOS Version
Product Version3.0.4Product Build 
Target VersionFixed in Version 
Summary0036133: not compiled some of the data transmitted in function Round
DescriptionWhen using this function, multiplying some numbers by a variable makes it impossible to compile the program for Windows 64 bit.
Steps To Reproduce1. Writing code:

var
q3: byte;
q2: longint;

begin
q3:=1;
q2:=round(141*q3);
end.

2. Compiled for for Windows 64 bit.
3. Get compilation error:

Compiling 3.pp
3.pp(7,5) Error: Can't determine which overloaded function to call
3.pp(9) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
Additional InformationIn Linux and Win32 the error is not found.
TagsNo tags attached.
Fixed in Revision
FPCOldBugId
FPCTarget
Attached Files
  • 3.pp (65 bytes)
    var
    q3: byte;
    q2: longint;
    
    begin
    q3:=1;
    q2:=round(141*q3);
    end.
    
    3.pp (65 bytes)
  • Project1.pas (65 bytes)
    program Project1;
    var
      q3: UInt64 = 1;
    begin
      Round(q3);
    end.
    
    
    Project1.pas (65 bytes)

Activities

Skvoznjak

2019-10-03 13:06

reporter  

3.pp (65 bytes)
var
q3: byte;
q2: longint;

begin
q3:=1;
q2:=round(141*q3);
end.
3.pp (65 bytes)

Sven Barth

2019-10-03 18:54

manager   ~0118286

Please note that in your specific example the Round is superfluous as you're working with Integer types anyway.
The Round is only necessary if you want to work with either floating point types or types like Currency or Comp. In those cases you should either use casts or declare one of the variables accordingly to have the correct results.
The overloads that the compiler picks up are those for Currency and Comp, but as those are both declared as Int64 on Win64 (or any non-x86 platform) the compiler can't pick the correct method, so you need to use one of the solutions above for now (though I don't know yet whether we're going to fix this, I've asked the other devs for their opinion).

Skvoznjak

2019-10-03 21:25

reporter   ~0118296

It happens that you don’t remember what type of variable or constant you have, and use Round again. Thus, it was discovered, and for a long time I could not understand why it was multiplied by 120 and everything was fine, and when multiplied by 141, an error occurred.

Boris Glavin

2019-10-09 12:25

reporter   ~0118443

In the file an example for all platforms

Project1.pas (65 bytes)
program Project1;
var
  q3: UInt64 = 1;
begin
  Round(q3);
end.

Project1.pas (65 bytes)

Issue History

Date Modified Username Field Change
2019-10-03 13:06 Skvoznjak New Issue
2019-10-03 13:06 Skvoznjak File Added: 3.pp
2019-10-03 18:54 Sven Barth Note Added: 0118286
2019-10-03 21:25 Skvoznjak Note Added: 0118296
2019-10-09 12:25 Boris Glavin File Added: Project1.pas
2019-10-09 12:25 Boris Glavin Note Added: 0118443