[fpc-devel] goto illegal in fpc?

Schneider schneidt at mail.nih.gov
Fri Oct 9 12:33:52 CEST 2015



This is a test program I use to check Pascal compilers.  I could not
figure out from the FPC site how "standard" it is.  When I try to
compile shell.p, I get:

% fpc shell.p
Free Pascal Compiler version 2.6.4 [2015/10/07] for x86_64
Copyright (c) 1993-2014 by Florian Klaempfl and others
Target OS: Darwin for x86_64
Compiling shell.p
shell.p(211,1) Error: Goto statements aren't allowed between different procedures
shell.p(234) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
Error: /sw/bin/ppcx64 returned an error exitcode (normal if you did not specify a source file to be compiled)

The use of the goto is to escape the program when it detects an
unresolvable error.  I use ONLY ONE goto in a 'halt' proceedure and
that gives a message and then does a goto to the end of the program.

As far as I know, jumping out of a procedure like this is standard
Pascal.  Many of my programs use this mechanism, so if it is not
allowed, I will be forced to abandon FPC.

(Note:  I never need goto for any other code so being forced to have
gotos stay within a single proceedure seems to make goto totally

I thought that the -Sg flag would allow this but it didn't help.

Is there a (non standard!) exit function in fpc that I could use
during compilation?  (Then I could substitute it for the goto call
before compiling.)

I used fink to install fpc.  I'm on OS X 10.10.5.  Since I just
started, I'm not on the fpc list yet, so please include my email in



  Thomas D. Schneider, Ph.D.
  Senior Investigator
  National Institutes of Health
  National Cancer Institute
  Center for Cancer Research
  Gene Regulation and Chromosome Biology Laboratory
  Molecular Information Theory Group
  Frederick, Maryland  21702-1201
  schneidt at mail.nih.gov
  https://schneider.ncifcrf.gov (current link)
  https://alum.mit.edu/www/toms (permanent link)

More information about the fpc-devel mailing list