|Re: Java virtual machine as target language for C/C++ firstname.lastname@example.org (1996-05-08)|
|Re: Java virtual machine as target language for C/C++ email@example.com (Daniel C. Wang) (1996-05-27)|
|Re: Java virtual machine as target language for C/C++ firstname.lastname@example.org (Dave Love) (1996-06-13)|
|Re: Java virtual machine as target language for C/C++ email@example.com (1996-06-21)|
|Optimization of Uncommon Code (Was Java ByteCode ...) firstname.lastname@example.org (1996-06-30)|
|Re: Optimization of Uncommon Code (Was Java ByteCode ...) email@example.com (Walter Spector) (1996-07-01)|
|Re: Optimization of Uncommon Code firstname.lastname@example.org (Dwight VandenBerghe) (1996-07-02)|
|Re: Optimization of Uncommon Code email@example.com (1996-07-03)|
|Re: Optimization of Uncommon Code (Was Java ByteCode ...) firstname.lastname@example.org (1996-07-04)|
|Re: Optimization of Uncommon Code (Was Java ByteCode ...) email@example.com (1996-07-05)|
|Re: Optimization of Uncommon Code firstname.lastname@example.org (Walter Spector) (1996-07-09)|
|[3 later articles]|
|From:||email@example.com (David L Moore)|
|Date:||30 Jun 1996 16:52:25 -0400|
|References:||96-05-061 96-05-163 96-06-048 96-06-081|
> f2c is a good case study for illustrating one type of problem with language A
> to language B translation systems.
> [f2c makes local variables static]
This used to be a common misconception - that locals in Fortran were
static and therefore retained their values from one call of a
procedure to the next. This was how Fortran was implemented on
some early machines.
Fortran 77 introduced the "save" statement to allow the programmer
to specify which variables should be static. Other variables can
be static or dynamic at the choice of the compiler.
So, either f2c has never been updated to the 77 standard in this area,
or else this is an example of a premature "optimisation" by a tool. In
either case, it is the tool that should be fixed, not the C optimizer.
[Sigh. Two minutes spent looking at the f2c manual page reveals that it has
an option to make variables automatic when it can. Some years ago I wrote
one of the earlier F77 compilers, INfort, and since it was running on a
PDP-11 with only a 16 bit address space, I tried hard to put everything on
the stack that I could. The customers hated it. There's millions of lines
of legacy Fortran code, almost all of which assumes that all variables are
static, regardless of what the F77 standard says. So I had to do the same
thing as f77 and f2c (which is f77 with a C generating back end) do, make
everything static unless requested otherwise. -John]
Return to the
Search the comp.compilers archives again.