The example below shows that sets have the wrong value from the initialization, but are ok if calcuated or if set in the code.
var vowels : letter_set := [ 'a', 'e', 'i', 'o', 'u' ] ;
is inconrrect,
vowels := [ 'a', 'e', 'i', 'o', 'u' ] ;
works fine.
I suspect it would work on a low-endian machine, but does not work on a big-endian. Dumping the set of vowels shows
44 41 04 00
which I thnk means [ 10 16 22 26 30 ] or [ j p v z ??? ] , whears it should be (and if you read from left you right you get) [ 1 5 9 15 21 ] or [ a e i o u ] .
From the assembly file
_Vowels: .ascii "DA\4\0" is incorrect here. For the assigment at line 22 there is inline code with specific ORs rather than moving constants.
% cat e.pas program e(input, output) ;
type small = 0..10 ; small_set = set of small ; letter = 'a' .. 'z' ; letter_set = set of letter ;
var vowels : letter_set := [ 'a', 'e', 'i', 'o', 'u' ] ; smalls : small_set := [ 1, 3, 5, 7, 9 ] ; c : letter ; i : integer ;
begin writeln('vowels #1:') ; for c := 'a' to 'z' do if c in vowels then writeln(c) ; writeln ;
vowels := [ 'a', 'e', 'i', 'o', 'u' ] ; writeln('vowels #2 :') ; for c := 'a' to 'z' do if c in vowels then writeln(c) ; writeln ;
writeln('smalls #1 :') ; for i := 0 to 10 do if i in smalls then write(i:1, ' ') ; writeln;
smalls := [] ; for i := 0 to 10 do if odd(i) then smalls := smalls + [i] ;
writeln('smalls #2:') ; for i := 0 to 10 do if i in smalls then write(i:1, ' ') ; writeln;
end. % gpc -o e e.pas e.pas: In function `program_E': e.pas:38: warning: constructing limited integer set `0..255' % ./e vowels #1: j p v z
vowels #2 : a e i o u
smalls #1 :
smalls #2: 1 3 5 7 9 %
Richard