View Issue Details

IDProjectCategoryView StatusLast Update
0007179FPCCompilerpublic2007-04-13 22:23
ReporterPhil Assigned ToJonas Maebe  
Status closedResolutionfixed 
PlatformIntelOSWindows XP 
Product Version2.2.0 
Fixed in Version2.2.0 
Summary0007179: Spurious warnings
DescriptionFPC 2.1.1 generates spurious "type size mismatch" warnings for some arithmetic expressions. FPC 2.0.2 and Delphi 7 do not generate these warnings.


program TestMismatch;

  TTestClass = class(TObject)
    procedure AProc(AValue : Single);

procedure TTestClass.AProc(AValue : Single);

  AnObj : TTestClass;
  ASingle : Single;
  AnObj := TTestClass.Create;
  ASingle := 1;
  AnObj.AProc(ASingle * 2); //Does not generate warning
  AnObj.AProc(ASingle * 2.0); //Generates warning with -Cr or -vh

TagsNo tags attached.
Fixed in Revision5927
Attached Files


Frederik Slijkerman

2006-08-03 12:21

reporter   ~0008593

FPC 2.1.1 generates a warning for each double/extended -> single conversion (and perhaps others as well). This is incorrect and should be fixed!

Frederik Slijkerman

2006-08-03 12:21

reporter   ~0008594

Also, a type cast to single(...) is not accepted by the compiler, so there is no way to 'fix' these warnings.

Jonas Maebe

2007-01-12 19:39

manager   ~0010813

FPC now, just like Delphi, sets the precision of floating point constants to the smallest one required (so 2.0 is now also a single, and therefore no warning is generated anymore for this test program).

To Frederik: explicit typecasting to single/double also works for me in FPC with the current 2.1.1.

Issue History

Date Modified Username Field Change
2006-07-19 18:55 Phil New Issue
2006-08-03 12:21 Frederik Slijkerman Note Added: 0008593
2006-08-03 12:21 Frederik Slijkerman Note Added: 0008594
2007-01-12 19:39 Jonas Maebe Fixed in Revision => 5927
2007-01-12 19:39 Jonas Maebe Status new => resolved
2007-01-12 19:39 Jonas Maebe Fixed in Version => 2.1.1
2007-01-12 19:39 Jonas Maebe Resolution open => fixed
2007-01-12 19:39 Jonas Maebe Assigned To => Jonas Maebe
2007-01-12 19:39 Jonas Maebe Note Added: 0010813
2007-04-13 22:23 Florian Status resolved => closed