View Issue Details

IDProjectCategoryView StatusLast Update
0036053FPCCompilerpublic2019-09-09 17:17
ReporterBloodbatgotAssigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
PlatformMS-DOS 16 bitOSWindowsOS Version10
Product Version3.0.4Product Build 
Target VersionFixed in Version 
Summary0036053: The MS-DOS 16 bit cross compiler refuses to compile when using an array with valid ranges.
DescriptionWhen trying to compile a 64000 byte array the cross compiler for MS-DOS refuses, even if -WmLarge is used. It is valid code: Turbo Pascal compiles it without a hitch and it is a way to, for example, access VGA memory to write to it.
Steps To ReproduceCreate an array with a range from 0 to 63999 (check the attached sample file), try to cross compile it for MS-DOS, the compiler refuses with an error:
"Error: The range of the array is too large".
If the same code is tried with dynamic arrays and SetLength, the compiler emits a warning:
"Warning: range check error while evaluating constants (64000 must be between -32768 and 32767)"
And, indeed, the program stops when trying to run it with an error 201.
TagsNo tags attached.
Fixed in Revision
FPCOldBugId
FPCTarget
Attached Files
  • test64.pas (98 bytes)
    unit Test64;
    
    interface
    
    type
      TArray64 = array[0..63999] of byte;
    
    implementation
    
    end.
    test64.pas (98 bytes)

Activities

Bloodbatgot

2019-09-06 21:11

reporter  

test64.pas (98 bytes)
unit Test64;

interface

type
  TArray64 = array[0..63999] of byte;

implementation

end.
test64.pas (98 bytes)

jamie philbrook

2019-09-07 00:41

reporter   ~0117962

The constants are 16 bit integers.

 Did you try casting it ?

[0..DWORD(64000)] of Byte ?

Or use LongInt(64000)

Worth a try anyways.

jamie philbrook

2019-09-07 00:44

reporter   ~0117964

Or Use WORD(64000), almost forgot that one..

Bloodbatgot

2019-09-07 12:27

reporter   ~0117968

I didn't at first; but, after your suggestion, now I have. Same error: array range too large.

Thaddy de Koning

2019-09-08 14:45

reporter   ~0117993

Last edited: 2019-09-08 14:50

View 4 revisions

I can't believe TP <= 5.5 accept that code. At least 3.0 fails, have to test 5.5. It may be just the last incarnation of BP7 accepted it, but I haven't got that anymore.
IIRC that is huge model only anyway.
[edit] TP 5.5 also does not accept it.
This is not true:
"When trying to compile a 64000 byte array the cross compiler for MS-DOS refuses, even if -WmLarge is used. It is valid code: Turbo Pascal compiles it without a hitch"

AFAIK not even BP7.0 compiles that in large mode.

Marģers

2019-09-08 15:37

reporter   ~0117994

confirm: TP7 can compile given test sample for dos real mode.

jamie philbrook

2019-09-08 18:26

reporter   ~0117997

My TP6.0 has no issues with that, its valid code it should compile..

 This is only a type being defined

Bloodbatgot

2019-09-09 17:16

reporter   ~0118005

Last edited: 2019-09-09 17:17

View 2 revisions

Thaddy: if PROPERLY defined (array[0..63999] of byte) does indeed compile under TP 5.5.

Issue History

Date Modified Username Field Change
2019-09-06 21:11 Bloodbatgot New Issue
2019-09-06 21:11 Bloodbatgot File Added: test64.pas
2019-09-07 00:41 jamie philbrook Note Added: 0117962
2019-09-07 00:44 jamie philbrook Note Added: 0117964
2019-09-07 12:27 Bloodbatgot Note Added: 0117968
2019-09-08 14:45 Thaddy de Koning Note Added: 0117993
2019-09-08 14:46 Thaddy de Koning Note Edited: 0117993 View Revisions
2019-09-08 14:48 Thaddy de Koning Note Edited: 0117993 View Revisions
2019-09-08 14:50 Thaddy de Koning Note Edited: 0117993 View Revisions
2019-09-08 15:37 Marģers Note Added: 0117994
2019-09-08 18:26 jamie philbrook Note Added: 0117997
2019-09-09 17:16 Bloodbatgot Note Added: 0118005
2019-09-09 17:17 Bloodbatgot Note Edited: 0118005 View Revisions