In article 200212150416.FAA27009@goedel.fjf.gnu.de, Frank Heckenbach frank@g-n-u.de writes
Martin Liddle wrote:
I am experimenting with gpc 20021128 built with gcc 3.2.1. However I have a compilation problem. The following code fails to compile with the error message:
ml.p:12: passing arg1 of Sys_stat from incompatible array.
I can reproduce the problem and will try to fix it (martin6.pas).
--- orig/module.c Fri Dec 6 15:51:22 2002 +++ p/module.c Sun Dec 15 05:14:20 2002
^^^^^^^^^ Oh dear :-( Anyway the patch fixes the previously reported problem. Thank you very much.
So now we move on to the next problem. The following code snippet (for the avoidance of doubt this is an artificial example hacked from a much larger piece of code and is of no practical use) fails to compile (gpc20021128 plus Frank's patch with gcc 3.2.1) with the error message:
ml3.p:17: passing arg 1 of 'File_is_writable' from incompatible pointer type'
Program ml3; uses gpc;
Type tfchar=File of Char; Var Dev:TFChar;
function file_is_writable(fileptr:PAnyFile):boolean; var b:bindingtype; begin (*file_is_writable*) b:=binding(fileptr^); file_is_writable:=(b.bound and b.writable); end; (*file_is_writable*)
begin Rewrite(Dev,'/dev/ttyS0'); if file_is_writable(Addr(dev)) then begin Writeln('OK'); end; end.
It compiles and runs with gpc 20020426. Is this a deliberate change or another bug?