View Issue Details

IDProjectCategoryView StatusLast Update
0015727FPCCompilerpublic2015-04-22 19:21
ReporterAlexei Chipovalov Assigned ToJonas Maebe  
PrioritynormalSeveritymajorReproducibilityhave not tried
Status closedResolutionfixed 
Product Version2.4.0 
Target Version2.4.2Fixed in Version2.4.2 
Summary0015727: range check error
DescriptionIn Delphi compatibility mode.
Format %x for DWORD with 1 in high bit results in range check error (compilation and run-time).

Format('Z=%x',[$F0F0F0F0])

Z:=$F0F0F0F0;
Format('Z=%x',[Z])
Steps To Reproduce{$APPTYPE CONSOLE}
program Test;
uses
  SysUtils;

var Z;

begin
  Z:=$F0F0F0F0;
  // next line works OK
  writeln('Z=',Z);

  // next line produces compilation error "Error: range check error while evaluating constants"
  // writeln(Format('Z=%x',[$F0F0F0F0]));

  // next line gives run-time error: "ERangeError : Range check error"
  writeln(Format('Z=%x',[Z]));
end.
TagsNo tags attached.
Fixed in Revision15201
FPCOldBugId0
FPCTarget
Attached Files

Relationships

related to 0027933 closedMichael Van Canneyt Cardinal in array of const leads to range check error 

Activities

Marco van de Voort

2010-02-10 10:55

manager   ~0034348

What is your reference delphi version (most notably: does your reference Delphi version support int64?)

Thank you.

Jonas Maebe

2010-02-10 13:50

manager   ~0034353

It works with Kylix 3 (Delphi 6.5). And the test program contains an error, the "var z;" should probably be "var z: cardinal;". And it also has to contain {$r+}.

Jonas Maebe

2010-02-10 16:55

manager   ~0034362

I have no idea what the proper way to fix this is though. There is no vtCardinal, only vtInteger and vtInt64. Kylix passes the parameter as vtInteger without checking the range. I think that's wrong, and that FPC is correct (or that alternatively it should pass it as vtInt64, but that may cause other problems).

Jonas Maebe

2010-02-10 17:36

manager   ~0034364

I've disabled range checking in this situation for Delphi mode only

Issue History

Date Modified Username Field Change
2010-02-10 04:19 Alexei Chipovalov New Issue
2010-02-10 10:55 Marco van de Voort Note Added: 0034348
2010-02-10 10:55 Marco van de Voort Status new => feedback
2010-02-10 13:50 Jonas Maebe Note Added: 0034353
2010-02-10 16:55 Jonas Maebe Note Added: 0034362
2010-02-10 17:36 Jonas Maebe Fixed in Revision => 14882
2010-02-10 17:36 Jonas Maebe Status feedback => resolved
2010-02-10 17:36 Jonas Maebe Fixed in Version => 2.5.1
2010-02-10 17:36 Jonas Maebe Resolution open => fixed
2010-02-10 17:36 Jonas Maebe Assigned To => Jonas Maebe
2010-02-10 17:36 Jonas Maebe Note Added: 0034364
2010-05-02 15:36 Jonas Maebe FPCOldBugId => 0
2010-05-02 15:36 Jonas Maebe Fixed in Revision 14882 => 15201
2010-05-02 15:36 Jonas Maebe Fixed in Version 2.5.1 => 2.4.1
2010-11-16 16:53 Jonas Maebe Target Version => 2.4.2
2011-05-02 10:43 Marco van de Voort Status resolved => closed
2015-04-22 19:21 Jonas Maebe Relationship added related to 0027933