DAIMI, 4.11.1999
Dear sirs
For a little over a year I have been using the gpc compiler with a reasonable degree of success. Yesterday I had the opportunity to test the latest (according to our systems programmer, Benedict Lofstedt) release of gpc. This gave rise to four comments:
1. The attached program `arraytest' checks subrange types and subscripted variables. There seems to be no check of exceeding the limits. See the attached output which is identical for the old and new version of gpc.
2. The attached program `arraytest2' checks what happens to the surroundings. When one assigns values outside the subscript range. I have declared var X, Y, Z : vektor and have exceeded the subscript range in Y. The latest release of gpc destroys the contents of Z whereas the old one destroys X
3. Program `virker' which includes `alfaplot' and `syntaks' is sent by separate mail. The program works well with the old gpc, but with the new release I get:
10> gpc virker.p In file included from virker.p:17: alfaplot: In function `Mark': alfaplot:299: Internal compiler error in `emit_library_call_value', at calls.c:3198 Please submit a full bug report. See URL:http://www.gnu.org/software/gcc/faq.html#bugreport for instructions.
4. If one omits the semicolon in line 63 (an error, I know, but one that did occur) of `syntaks', the second line of procedure AR var xa, xb, ya, yb : real <-- the old compiler produces so many lines of diagnostics, that I had a hard time finding the first (and only important) one. This is just one example, that gpc has problems recovering after an error.
program arraytest(output); (* test of overflow in subrange and array-index. gpc allows the following program, pc does not *) type small = 0..100; vektor = array [small] of integer; var X, Y : vektor; A : array [0..5, 0..5] of integer; i, n : small; begin n := 98; for i := 1 to 7 do begin n := n + 1; X[n] := n+6; A[i,n] := i + n; writeln(n:4, X[n]:4, A[i,n]:5) end end.
4> gpc arraytest.p 5> a.out 99 105 100 100 106 102 101 107 104 102 108 106 103 109 108 104 110 110 105 111 112
program arraytest2(output); (* test of consequenses of overflow in array-index *) type small = 0..5; vektor = array [small] of integer; var X, Y, Z : vektor; i, n : small; begin for i := 0 to 5 do begin X[i] := i+10; Y[i] := i+30; Z[i] := i+50 end; for i := 0 to 5 do writeln(i:3, X[i]:5, Y[i]:5, Z[i]:5); for i := 1 to 10 do Y[i] := i+100; for i := 0 to 5 do writeln(i:3, X[i]:5, Y[i]:5, Z[i]:5) end.
7> gpc arraytest2.p 8> a.out 0 10 30 50 1 11 31 51 2 12 32 52 3 13 33 53 4 14 34 54 5 15 35 55 0 10 30 106 output using the new release of gpc 1 11 101 107 2 12 102 108 3 13 103 109 4 14 104 110 5 15 105 55
10> a.out 0 10 30 50 1 11 31 51 2 12 32 52 3 13 33 53 4 14 34 54 5 15 35 55 0 106 30 50 output using the old one 1 107 101 51 2 108 102 52 3 109 103 53 4 110 104 54 5 15 105 55
Sincerely
Ole Osterby Department of Computer Science Aarhus University