Frank Heckenbach replied:
>It has been
>fixed by now, and your test program will compile with the next GPC
>version. Thanks for the report, anyway.
Has this next version been released? I have searched the net and
the latest version I could find any reference to was the one I am
already using (19980830). If a new version has not been released,
is there somewhere I can get a patch for this particular problem?
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
Orlando Llanes wrote:
> I get the following error with the program listed below:
>
> 0c:/nano/tmp2.exe: could not read all the data from file `tmp.txt' in
> `BlockRead' (#414)
>
> Seems that it prints the first character, but then ends unexpectedly. The
> file tmp.txt is below the program.
This seems to be due to a DJGPP bug (fflush() clobbers the file
position -- or is this allowed, any standard experts here?). For
now, I put a work-around in the RTS for Dos systems. Perhaps this
should better be done by an autoconf test, but I don't know how to
do this (any autoconf experts here?).
--
Frank Heckenbach, frank(a)fjf.gnu.de
http://fjf.gnu.de/
PGP and GPG keys: http://fjf.gnu.de/plan
I get the following error with the program listed below:
0c:/nano/tmp2.exe: could not read all the data from file `tmp.txt' in
`BlockRead' (#414)
Seems that it prints the first character, but then ends unexpectedly. The
file tmp.txt is below the program.
{--- Cut here for tmp2.pas ---}
program Tmp2;
var
F : File;
Ch : Char;
begin
Assign( F, 'tmp.txt' );
Reset( F, 1 );
while not EOF(F) do
begin
BlockRead( F, Ch, 1 );
Write( Ch );
end;
Close( F );
end.
{--- Cut here ---}
{--- Cut here for tmp.txt ---}
0x3dF
0X3Af
++
TestOJL,
++=
1e0
1.2
22.3e-3
309
,
_1234567890_1234567890_1234567890_1234567890_1234567890_1234567890
_Testing_123
This_is_a_really_long_variable_in_fact_only_part_of_it_will_be_kept_the_rest_will_be_ignored
' '
''
''''
print( 'foo' )
foo
'a string' 'another string'
__test__
==
-=
<<
>>
>>=
if
main print() endmain
{--- Cut here ---}
See ya!
Orlando Llanes
"Meine Damen und Herren, Elvis hat soeben das Gebaeude verlassen!"
"Look out fo' flyeeng feet"
O__/ a010111t(a)bc.seflin.org
\/|____. O
<__. \/\>
/ \
____________|___\______ http://ourworld.compuserve.com/homepages/Monkey414
Sam B wrote:
> Greetings,
> I am having a rather strange problem when using an enumerated
> type declared in a unit. If that type is used in a second unit,
> and also in a third that uses both the first and second, the
> type cannot be used as a parameter to a function. This probably
> isn't a very good description
Actually, it is ;-), because this was a notorious bug. It has been
fixed by now, and your test program will compile with the next GPC
version. Thanks for the report, anyway.
Frank
--
Frank Heckenbach, frank(a)fjf.gnu.de
http://fjf.gnu.de/
PGP and GPG keys: http://fjf.gnu.de/plan
Greetings,
I am having a rather strange problem when using an enumerated
type declared in a unit. If that type is used in a second unit,
and also in a third that uses both the first and second, the
type cannot be used as a parameter to a function. This probably
isn't a very good description, so please just look at the
example I have included at the end of this post, it is the
smallest program I could produce to generate the problem.
The output from gpc is:
> gpc p.pas
p.pas: In function `program_P':
p.pas:23: incompatible type for argument 1 of `U_proc'
I am running on Redhat Linux 5.0, and my gpc version is version
19980830, based on gcc-2.8.1.
Does anyone know what might be causing this, and if there is
a workaround or fix?
Thanks in advance,
Sam.
--- begin example (p.pas) ---
unit e;
interface
type
t_e = ( e_a, e_b );
implementation
begin
end.
unit u;
interface
uses e;
procedure u_proc(e: t_e);
implementation
procedure u_proc;
begin
end;
begin
end.
program p;
uses e, u;
begin
u_proc(e_a); { error is generated on this line }
end.
--- end example ---
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
Hello again, fellow Pascalers!
After getting a bug fix for the set addition problem from Peter
(thanks very much Peter!) within 24 hours I've decided to try my
luck again.
There is some strangeness with the gpc-cpp preprocessor; here is some
code to trigger it:
------- main.h ---------
#ifndef Funny
#define Funny 1
#endif
{**}
{**}
------- end ------------
------- main.p ---------
program MxFiler;
#include "main.h"
BEGIN
writeln('Hello ');
END.
------- end ------------
If you do:
ida % gpc -E main.p
then gpc-cpp goes into a infinite loop.
Now the strange bit. If you remove any of these lines/characters the
preprocessing works as expected:
1) Change #ifndef to #ifdef in main.h
2) Remove the #ifndef and #endif lines in main.h
3) Remove either of the comment lines in main.h
4) Remove the trailing '}' from the first comment line in main.h
5) Remove #include from main.p and replace it with the contents of main.h
I can easily work around this of course, but a fix would be better!
Thanks for any help!
Ian
--
Ian Thurlbeck http://www.stams.strath.ac.uk/
Statistics and Modelling Science, University of Strathclyde
Livingstone Tower, 26 Richmond Street, Glasgow, UK, G1 1XH
Tel: +44 (0)141 548 3667 Fax: +44 (0)141 552 2079
Dear Pascalers
The following code core dumps during the set 'in' operation:
------ cut ----------
program setbug(input,output);
CONST
FirstChar = ['+','-','0'..'9'];
#ifdef FIX
GoodChar = ['+','-','0'..'9','.','e','E'];
#else
GoodChar = FirstChar+['.','e','E'];
#endif
VAR
ch:CHAR;
in_set:BOOLEAN;
BEGIN
ch:='0';
writeln('Here we go:');
in_set:= ch IN GoodChar;
writeln('in_set is ', in_set);
END.
------ cut ----------
ida % gpc -g -o tt tt.p
ida % ./tt
Here we go:
Segmentation fault (core dumped)
ida % gdb /usr/local/egcs-1.1b-obj/lib/gcc-lib/i586-pc-linux-gnu/egcs-2.91.57/gpc1 core
[ ... ]
Core was generated by `./tt'.
Program terminated with signal 11, Segmentation fault.
#0 0x80491f5 in rindex ()
(gdb) backtrace
#0 0x80491f5 in rindex ()
#1 0x4000a1f8 in ?? ()
#2 0x8049348 in ftell ()
(gdb)
Note I can fix it by using the alternate code:
ida % gpc -DFIX -g -o tt tt.p
ida % ./tt
Here we go:
in_set is True
ida %
Compiler details:
ida % gpc -v
Reading specs from /usr/local/egcs-1.1b-obj/lib/gcc-lib/i586-pc-linux-gnu/egcs-2.91.57/specs
gpc version 19980830, based on egcs-2.91.57 19980901 (egcs-1.1 release)
Any suggestions ? Of course I can always use the workaround.
Many thanks
Ian
--
Ian Thurlbeck http://www.stams.strath.ac.uk/
Statistics and Modelling Science, University of Strathclyde
Livingstone Tower, 26 Richmond Street, Glasgow, UK, G1 1XH
Tel: +44 (0)141 548 3667 Fax: +44 (0)141 552 2079
Ian Thurlbeck wrote:
> #ifdef FIX
> GoodChar = ['+','-','0'..'9','.','e','E'];
> #else
> GoodChar = FirstChar+['.','e','E'];
> #endif
>
> [...]
>
> Any suggestions ? Of course I can always use the workaround.
Unfortunately no other suggestion. GPC's set code is not very
reliable, and esp. set addition is known to be buggy. :-( Since
there don't seem to be many programmers using sets (besides you and
me), this problem doesn't have very high priority on the to-do
list...
So, you'll probably have to live with workarounds for awhile --
unless you want to hack GPC itself and fix the bugs...
Frank
--
Frank Heckenbach, frank(a)fjf.gnu.de
http://fjf.gnu.de/
PGP and GPG keys: http://fjf.gnu.de/plan