View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0007179 | FPC | Compiler | public | 2006-07-19 18:55 | 2007-04-13 22:23 |
Reporter | Phil | Assigned To | Jonas Maebe | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Platform | Intel | OS | Windows XP | ||
Product Version | 2.2.0 | ||||
Fixed in Version | 2.2.0 | ||||
Summary | 0007179: Spurious warnings | ||||
Description | FPC 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. Example: program TestMismatch; type TTestClass = class(TObject) public procedure AProc(AValue : Single); end; procedure TTestClass.AProc(AValue : Single); begin WriteLn(AValue); end; var AnObj : TTestClass; ASingle : Single; begin AnObj := TTestClass.Create; ASingle := 1; AnObj.AProc(ASingle * 2); //Does not generate warning AnObj.AProc(ASingle * 2.0); //Generates warning with -Cr or -vh end. | ||||
Tags | No tags attached. | ||||
Fixed in Revision | 5927 | ||||
FPCOldBugId | |||||
FPCTarget | |||||
Attached Files |
|
|
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! |
|
Also, a type cast to single(...) is not accepted by the compiler, so there is no way to 'fix' these warnings. |
|
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. |
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 |