Michael Hofmann wrote:
Hi,
the following little program doesn't run under gpc version 2.0(2.7.2.1)!
program lesen (infile,output);
const n = 100;
type text = File of char; filearray = array[1..n] of real;
var i : integer; infile : text; filearray1 : filearray;
begin reset(infile); for i:= 1 to n do begin read(infile,filearray1[i]); write(filearray1[i]); end;
end.
I get the compiler message:gpc: Internal compiler error: program gpc1 got fatal signal 6 I know that the program runs under a Sun-Compiler!
when I substitute filearray = array[1..n] of real; by filearray = array[1..n] of integer; , then compilation is successful.
The problem is your declaration:
type text = File of char;
According to the Pascal standards, a `Text' file is similar to a `File of Char', but not the same. In particular, one can read numeric data from `Text' files, but not from `File of Char'. If the Sun compiler allows this, that's non-standard behaviour, which GPC currently does not support.
However, if you just remove this declaration, it should work, since `Text' is a predefined type in Pascal. If you then still get problems with GPC, please upgrade to a recent alpha or beta version (already much more stable than 2.0), available from:
ftp://agnes.dida.physik.uni-essen.de/gnu-pascal/alpha/ ftp://agnes.dida.physik.uni-essen.de/gnu-pascal/beta/
Frank