Waldek Hebisch wrote:
I just intalled gpc 2.1 on top of gcc 2.95.3 (all on slightly updated RedHat 7.0). When I type:
gpc --interface-only tp.pp
Doesn't it say:
gpc: `--interface-only' must be used together with `-S' or `-c'
But assuming you also gave `-S' or `-c', I can reproduce the problem.
I get gpc: Internal compiler error: program gpc1 got fatal signal 11
The content of tp.pp is:
program tp; begin end.
It looks that compiler crashes when there is no interface in the file (I found it on much bigger files, and with lot of other options). The problem also appears in older version of gpc on another machine.
The actual problem is that `--interface-only' implies `--syntax-only'. When compiling the main program, GPC emits some things that the backend doesn't expect with `--syntax-only' (whereas normally, in a unit or module, compilation stops and the end of the interface and never gets to the initializer/finalizer which is roughly equivalent to the main program, so the problem didn't show there). I hope the following will fix it (though there might be more places that need fixing). (waldek1.pas)
The manual says that gpc 2.1 accepts nested comments but when I try
gpc --nested-comments nn.pas
with nn.pas beeing
program nn; (* Can NOT compile with --nested-comments *) begin (* (* *) *) end.
the compiler complains about '*'
Thanks for the report (it works if `-Wall' is also given). Fix attached. (waldek2.pas)
The following ugly syntax (taken from FPC sources :) is not accepted even in Borland Pascal mode (supposedly BP compiles the code):
unit ttt; interface function foo(const s : string) : integer; implementation function foo(const s : string) : integer; var i,j:integer; begin for i:=1to 5 do j:=j+1; foo := j; end; end.
The compiler complines about 'nondigits in number whose radix <= 10' in the line containing 'for' and then cannot find 'to' or 'downto'.
Yes, that's a known issue. I'll fix it sometime -- more precisely, the lexer (the part that splits the input into tokens) will be replaced be a completely new one (it's about 80% finished, but not a high priority). The new one can handle this case. But I have no real plans to fix it in the old one. (waldek3.pas)
Finally, the manual claims that all one-letter switches in BP are supported, but (again in FPC source) R switch (range check) is not recognized and compilation is aborted on
{$ifopt R+}
The claim in the manual is wrong, I'll change it (in the section `BP Compatible Compiler Directives', or did you find it also somewhere else?). A few such as R are still missing.
Maurice Lombardi wrote:
for i:=1to 5 do j:=j+1;
^
space missing !
Yes, that's the point. BP does in fact allow this.
Frank