Thread View: comp.sys.sequent
1 messages
1 total messages
Started by Brian R. Smith
Sat, 31 Dec 1988 01:59
Bug in Sequent Pascal compiler
Author: Brian R. Smith
Date: Sat, 31 Dec 1988 01:59
Date: Sat, 31 Dec 1988 01:59
60 lines
1819 bytes
1819 bytes
I think we've found a bug in Sequent Pascal - could someone verify this?
The elements of a multi-dimensional packed arrays are not addressed
properly when they can be represented in 4 bits or less.
The real credit for this goes to Larry Lemay (lemay@umn-cs) who was just
trying to do some graphics printouts.
Example:
with
var
foo: packed array[0..7,0..7] of boolean;
{ or array[0..7] of packed array[0..7] of boolean; - same thing.}
foo[0,1] = foo[1,0], always
foo[0,2] = foo[1,1] = foo[2,0], always
foo[0,3] = foo[1,2] = foo[2,1] = foo[3,0], always
etc.
a 1 bit offset where there should be a 1 BYTE offset.
and with
var
foo: packed array[0..7,0..7] of 0..3;
foo[0,2] = foo[1,0], always
foo[0,3] = foo[1,1], always
foo[0,4] = foo[1,2] = foo[2,0], always
etc.
a 4 bit offset where there should be a 2 byte offset.
Try it.
------------------------------
program simpletest(input,output);
var
A: array[0..7] of packed array[0..7] of 0..15;
i,j: integer;
begin
for i:= 0 to 7 do
begin
for j:= 0 to 7 do
A[i,j]:=i+j;
end;
for i:= 0 to 7 do
begin
for j:= 0 to 7 do
begin
write(A[i,j]:3);
if A[i,j]<>i+j then write('*') else write(' ');
end;
writeln;
end;
end.
------------------------------
Brian
brsmith@umn-cs.cs.umn.edu
U of MN CSci dept.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads