compiler problem
Peter Gerwinski
peter at gerwinski.de
Wed Jun 30 16:22:16 CEST 1999
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
--
Peter Gerwinski, Essen, Germany, http://home.pages.de/~Peter.Gerwinski/
Maintainer GNU Pascal - http://home.pages.de/~GNU-Pascal/ - gpc-19990118
PGP key on request - 6C 94 45 BE 28 A4 96 - 0E CC E9 12 47 25 82 75
*** Vote against SPAM! ********* http://www.politik-digital.de/spam/ ***
More information about the Gpc
mailing list