packed types and comparison operators bugs

Couperin f.couperin at online.fr
Mon Jul 31 22:40:36 CEST 2000


Maurice Lombardi wrote :

>> I can't compile this little program :
>> --------------------------------------------
>> Program Bug05;
>> Const
>>   XValMax : Byte = 125;
>> Type
>>   T_XVal = Packed 0..XValMax;
>> Var
>>   X : T_XVal = 64;
>> Begin
>> End.
>> --------------------------------------------
>> Here is the output :
>> 
>> Reading specs from c:/djgpp/lib/gcc-lib/djgpp/2.952/specs
>> gpc version 20000727, based on 2.95.2 19991024 (release)
>> [...]
>> Bug05.pas:8: constant out of range

>??? For me it works ???
>I have the same version of the compiler and djgpp


I don't understand what happened earlier today : now it compiles without 
problems.
A possible explanation (?) : I write my programs under Windows, in a text editor, 
I have a lot of programs opened at the same time, and I run GPC in a DOS 
window : maybe the source wasn't fully saved... (but I made several tries...)


He also wrote :

> I suppose that you have indeed found a bug.
> To understand what is going on I have added a declaration
> 
> var Y: byte absolute X;
> 
> which enables to examine the binary contents of X.
> It is the same (at least for x=64)
> and all tests work as expected if you replace X by Y
> 
> ???

I made another attempt :
I wrote X into a File [ XFile : File Of T_XValue; ] : there is no problem, it wrote a 
byte with value 64 (40h). But I tried to read this value back into a program [  
Read(XFile,X); ], the output is always the same [ 64 < 63 :-( ].

--
"Couperin"

Unrelated P.S.
  Great thanks for your work on GRX. I downloaded it and installed it : everything 
is fine.




More information about the Gpc mailing list