🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.sequent
Article #729

Bug in Sequent Pascal compiler

#729
From: Brian R. Smith
Date: Sat, 31 Dec 1988 01:59
60 lines
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.
Technical Details
Message-ID: <10605@umn-cs.CS.UMN.EDU>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!csd4.milw.wisc.edu!nic.MR.NET!umn-cs!brsmith

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!csd4.milw.wisc.edu!nic.MR.NET!umn-cs!brsmith
From: brsmith@umn-cs.CS.UMN.EDU (Brian R. Smith)
Newsgroups: comp.sys.sequent
Subject: Bug in Sequent Pascal compiler
Keywords: bugs, pascal
Message-ID: <10605@umn-cs.CS.UMN.EDU>
Date: 31 Dec 88 01:59:38 GMT
Organization: University of Minnesota, Minneapolis
Lines: 60