Re^2: Oh noooooo!!

Jim Giles jlg at lanl.gov
Wed Sep 27 07:10:08 AEST 1989


>From article <1098 at cernvax.UUCP>, by hjm at cernvax.UUCP (Hubert Matthews):
> Programs that don't use GOTOs generate only reducible flow-graphs;
> programs that use GOTOs may generate irreducible flow-graphs.
> [...]        Thus, the optimiser can be simpler for languages such as
> C, PASCAL and Modula-2 compared to FORTRAN.  Take a look in the Dragon
  ^
> Book (Aho et al.) for more details.

The problem here is that C allows GOTOs in all the same contexts
that Fortran does.  More importantly, C allows GOTOs that even 
Fortran doesn't.  For example:

   C                                          Fortran

   if (a<b) {                               IF (A.LT.B) THEN
      ...                                      ...
lab1: ...                             10    CONTINUE
      ...                                      ...
   }                                        ENDIF
...                                         ...
goto lab1                                   GOTO 10

This jump is allowed by C but not by Fortran.  In fact, even the
proposed C standard has no constraints on the target of a GOTO
other than that the target label must be within the same program
unit as the GOTO statement.

So, the optimizer for C _cannot_ be any simpler than that for
Fortran.



More information about the Comp.lang.c mailing list