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.
Michael.
mail:hofmann@ph2.uni-koeln.de
Hallo, Michael!
the following little program doesn't run under gpc version 2.0(2.7.2.1)!
This version of GPC is over two years old. Better upgrade to at least gpc-19990118. (See `http://home.pages.de/~GNU-Pascal/' for more information, or download the stuff from `ftp://agnes.dida.physik.uni-essen.de/gnu-pascal/beta/'.)
text = File of char;
This overrides the built-in `Text' type which has `readln' ...
filearray = array[1..n] of real; [...] read(infile,filearray1[i]);
This cannot work since `read' from a `file of char' expects a `char' variable to hold the value. You could however `read' a `real' number from a `text' file (with the built-in `text').
I get the compiler message:gpc: Internal compiler error: program gpc1 got fatal signal 6
That's probably due to an error in the obsolete gpc-2.0. Better upgrade.
I know that the program runs under a Sun-Compiler!
That's strange. Is `file of char' equivalent to `text' in the Sun Compiler? According to the standard, it is not.
when I substitute filearray = array[1..n] of real; by filearray = array[1..n] of integer; , then compilation is successful.
Then both gpc-2.0 and your Sun's Pascal have the same bug accepting a non-`char' variable as an argument to `read' from a `file of char'. gpc-19990118 correctly rejects the program also with `integer' unless you remove the `text = file of char' declaration.
Hope this helps,
Peter