@c Copyright (C) 1995, 1996 Free Software Foundation, Inc.
@c This is part of the G77 manual.
@c For copying conditions, see the file g77.texi.

@c The text of this file appears in the file BUGS
@c in the G77 distribution, as well as in the G77 manual.

@c 1996-04-01

@ifclear NEWSONLY
@node News
@chapter News About GNU Fortran
@end ifclear
@cindex versions, recent
@cindex recent versions

@heading In 0.5.18:
@itemize @bullet
@item
Add some rudimentary support for @samp{INTEGER*1},
@samp{INTEGER*2}, @samp{INTEGER*8},
and their @samp{LOGICAL} equivalents.
(This support works on most, maybe all, @code{gcc} targets.)

Thanks to Scott Snyder (@code{snyder@@d0sgif.fnal.gov})
for providing the patch for this!

Among the missing elements from the support for these
features are full intrinsic support and constants.

@item
Add some rudimentary support for the @samp{BYTE} and
@samp{WORD} type-declaration statements.
@samp{BYTE} corresponds to @samp{INTEGER*1},
while @samp{WORD} corresponds to @samp{INTEGER*2}.

Thanks to Scott Snyder (@code{snyder@@d0sgif.fnal.gov})
for providing the patch for this!

@item
The compiler code handling intrinsics has been largely
rewritten to accommodate the new types.
No new intrinsics or arguments for existing
intrinsics have been added, so there is, at this
point, no intrinsic to convert to @samp{INTEGER*8},
for example.

@item
Support automatic arrays in procedures.

@item
Reduce space/time requirements for handling large
@emph{sparsely} initialized aggregate arrays.
This improvement applies to only a subset of
the general problem to be addressed in 0.6.

@item
Treat initial values of zero as if they weren't
specified (in DATA and type-declaration statements).
The initial values will be set to zero anyway, but the amount
of compile time processing them will be reduced,
in some cases significantly (though, again, this
is only a subset of the general problem to be
addressed in 0.6).

A new option, @samp{-fzeros}, is introduced to
enable the traditional treatment of zeros as any
other value.

@item
With @samp{-ff90} in force, @code{g77} incorrectly
interpreted @samp{REAL(Z)} as returning a @samp{REAL}
result, instead of as a @samp{DOUBLE PRECISION}
result.
(Here, @samp{Z} is @samp{DOUBLE COMPLEX}.)

With @samp{-fno-f90} in force, the interpretation remains
unchanged, since this appears to be how at least some
F77 code using the @samp{DOUBLE COMPLEX} extension expected
it to work.

Essentially, @samp{REAL(Z)} in F90 is the same as
@samp{DBLE(Z)}, while in extended F77, it appears to
be the same as @samp{REAL(REAL(Z))}.

@item
An expression involving exponentiation, where both operands
were type @samp{INTEGER} and the right-hand operand
was negative, was erroneously evaluated.

@item
Fix bugs involving @samp{DATA} implied-@samp{DO} constructs
(these involved an errant diagnostic and a crash, both on good
code, one involving subsequent statement-function definition).

@item
Close @samp{INCLUDE} files after processing them, so compiling source
files with lots of @samp{INCLUDE} statements does not result in
being unable to open @samp{INCLUDE} files after all the available
file descriptors are used up.

@item
Speed up compiling, especially of larger programs, and perhaps
slightly reduce memory utilization while compiling (this is
@emph{not} the improvement planned for 0.6 involving large aggregate
areas)---these improvements result from simply turning
off some low-level code to do self-checking that hasn't been
triggered in a long time.

@item
Introduce three new options that
implement optimizations in the @code{gcc} back end (GBE).
These options are @samp{-fmove-all-movables}, @samp{-freduce-all-givs},
and @samp{-frerun-loop-opt}, which are enabled, by default,
for Fortran compilations.
These optimizations are intended to help toon Fortran programs.

@item
Patch the GBE to do a better job optimizing certain
kinds of references to array elements.

@item
Due to patches to the GBE, the version number of @code{gcc}
also is patched to make it easier to manage installations,
especially useful if it turns out a @code{g77} change to the
GBE has a bug.

The @code{g77}-modified version number is the @code{gcc}
version number with the string @samp{.f.@var{n}} appended,
where @samp{f} identifies the version as enhanced for
Fortran, and @var{n} is @samp{1} for the first Fortran
patch for that version of @code{gcc}, @samp{2} for the
second, and so on.

So, this introduces version @samp{2.7.2.f.1} of @code{gcc}.

@item
Make several improvements and fixes to diagnostics, including
the removal of two that were inappropriate or inadequate.

@item
Warning about two successive arithmetic operators, produced
by @samp{-Wsurprising}, now produced @emph{only} when both
operators are, indeed, arithmetic (not relational/boolean).

@item
@samp{-Wsurprising} now warns about the remaining cases
of using non-integral variables for implied-@code{DO}
loops, instead of these being rejected unless @samp{-fpedantic}
or @samp{-fugly} specified.

@item
Allow @samp{SAVE} of a local variable or array, even after
it has been given an initial value via @samp{DATA}, for example.

@item
Introduce an Info version of @code{g77} documentation, which
supercedes @file{gcc/f/CREDITS}, @file{gcc/f/DOC}, and
@file{gcc/f/PROJECTS}.
These files will be removed in a future release.
The files @file{gcc/f/BUGS}, @file{gcc/f/INSTALL}, and
@file{gcc/f/NEWS} now are automatically built from
the texinfo source when distributions are made.

This effort was inspired by a first pass at translating
@code{g77-0.5.16/f/DOC} that was contributed to Craig by
David Ronis (@code{ronis@@onsager.chem.mcgill.ca}).

@item
New @samp{-fno-second-underscore} option to specify
that, when @samp{-funderscoring} is in effect, a second
underscore is not to be appended to Fortran names already
containing an underscore.

@item
Change the way iterative @code{DO} loops work to follow
the F90 standard.
In particular, calculation of the iteration count is
still done by converting the start, end, and increment
parameters to the type of the @code{DO} variable, but
the result of the calculation is always converted to
the default @samp{INTEGER} type.

(This should have no effect on existing code compiled
by @code{g77}, but code written to assume that use
of a @emph{wider} type for the @code{DO} variable
will result in an iteration count being fully calculated
using that wider type (wider
than default @samp{INTEGER}) must be rewritten.)

@item
Upgrade to @code{libf2c} as of 1996-03-23, and
fix up some of the build procedures.

Note that the email addresses related to @code{f2c}
have changed---the distribution site now is
named @code{netlib.bell-labs.com}, and the
maintainer's new address is @code{dmg@@bell-labs.com}.
@end itemize

@heading In 0.5.17:
@itemize @bullet
@item
@strong{Fix serious bug} in @samp{g77 -v} command that can cause removal of a
system's @file{/dev/null} special file if run by user @samp{root}.

@strong{All users} of version 0.5.16 should ensure that
they have not removed @file{/dev/null} or replaced it with an ordinary
file (e.g. by comparing the output of @samp{ls -l /dev/null} with
@samp{ls -l /dev/zero}.
If the output isn't basically the
same, contact your system
administrator about restoring @file{/dev/null} to its proper status).

This bug is particularly insidious because removing @file{/dev/null} as
a special file can go undetected for quite a while, aside from
various applications and programs exhibiting sudden, strange
behaviors.

I sincerely apologize for not realizing the
implications of the fact that when @samp{g77 -v} runs the @code{ld} command
with @samp{-o /dev/null} that @code{ld} tries to @emph{remove} the executable
it is supposed to build (especially if it reports unresolved
references, which it should in this case)!

@item
Fix crash on @samp{CHARACTER*(*) FOO} in a main or block data program unit.

@item
Fix crash that can occur when diagnostics given outside of any
program unit (such as when input file contains @samp{@@foo}).

@item
Fix crashes, infinite loops (hangs), and such involving diagnosed code.

@item
Fix @samp{ASSIGN}'ed variables so they can be @samp{SAVE}'d or dummy arguments,
and issue clearer error message in cases where target of @samp{ASSIGN}
or @samp{ASSIGN}ed @samp{GOTO}/@samp{FORMAT} is too small (which should
never happen).

@item
Make @code{libf2c} build procedures work on more systems again by
eliminating unnecessary invocations of @samp{ld -r -x} and @samp{mv}.

@item
Fix omission of @samp{-funix-intrinsics-@dots{}} options in list of permitted
options to compiler.

@item
Fix failure to always diagnose missing type declaration for
@samp{IMPLICIT NONE}.

@item
Fix compile-time performance problem (which could sometimes
crash the compiler, cause a hang, or whatever, due to a bug
in the back end) involving exponentiation with a large @samp{INTEGER}
constant for the right-hand operator (e.g. @samp{I**32767}).

@item
Fix build procedures so cross-compiling @code{g77} (the @code{fini}
utility in particular) is properly built using the host compiler.

@item
Add new @samp{-Wsurprising} option to warn about constructs that are
interpreted by the Fortran standard (and @code{g77}) in ways that
are surprising to many programmers.

@item
Add @samp{ERF()} and @samp{ERFC()} as generic intrinsics mapping to existing
@samp{ERF}/@samp{DERF} and @samp{ERFC}/@samp{DERFC} specific intrinsics.

@emph{Note:} You should
specify @samp{INTRINSIC ERF,ERFC} in any code where you might use
these as generic intrinsics, to improve likelihood of diagnostics
(instead of subtle run-time bugs) when using a compiler that
doesn't support these as intrinsics (e.g. @code{f2c}).

@item
Remove from @samp{-fno-pedantic} the diagnostic about @samp{DO}
with non-@samp{INTEGER} index variable; issue that under
@samp{-Wsurprising} instead.

@item
Clarify some diagnostics that say things like ``ignored'' when that's
misleading.

@item
Clarify diagnostic on use of @samp{.EQ.}/@samp{.NE.} on @samp{LOGICAL}
operands.

@item
Minor improvements to code generation for various operations on
@samp{LOGICAL} operands.

@item
Minor improvement to code generation for some @samp{DO} loops on some
machines.

@item
Support @code{gcc} version 2.7.1.

@item
Upgrade to @code{libf2c} as of 1995-11-15.
@end itemize

@heading In 0.5.16:
@itemize @bullet
@item
Fix a code-generation bug involving complicated @samp{EQUIVALENCE} statements
not involving @samp{COMMON}

@item
Fix code-generation bugs involving invoking ``gratis'' library procedures
in @code{libf2c} from code compiled with @samp{-fno-f2c} by making these
procedures known to @code{g77} as intrinsics (not affected by -fno-f2c).
This is known to fix code invoking @samp{ERF()}, @samp{ERFC()},
@samp{DERF()}, and @samp{DERFC()}.

@item
Update @code{libf2c} to include netlib patches through 1995-08-16, and
@samp{#define} @samp{WANT_LEAD_0} to 1 to make @code{g77}-compiled code more
consistent with other Fortran implementations by outputting
leading zeros in formatted and list-directed output.

@item
Fix a code-generation bug involving adjustable dummy arrays with high
bounds whose primaries are changed during procedure execution, and
which might well improve code-generation performance for such arrays
compared to @code{f2c} plus @code{gcc} (but apparently only when using
@file{gcc-2.7.0} or later).

@item
Fix a code-generation bug involving invocation of @samp{COMPLEX} and
@samp{DOUBLE COMPLEX} @samp{FUNCTION}s and doing @samp{COMPLEX} and
@samp{DOUBLE COMPLEX} divides, when the result
of the invocation or divide is assigned directly to a variable
that overlaps one or more of the arguments to the invocation or divide.

@item
Fix crash by not generating new optimal code for @samp{X**I} if @samp{I} is
nonconstant and the expression is used to dimension a dummy
array, since the @code{gcc} back end does not support the necessary
mechanics (and the @code{gcc} front end rejects the equivalent
construct, as it turns out).

@item
Fix crash on expressions like @samp{COMPLEX**INTEGER}.

@item
Fix crash on expressions like @samp{(1D0,2D0)**2}, i.e. raising a
@samp{DOUBLE COMPLEX} constant to an @samp{INTEGER} constant power.

@item
Fix crashes and such involving diagnosed code.

@item
Diagnose, instead of crashing on, statement function definitions
having duplicate dummy argument names.

@item
Fix bug causing rejection of good code involving statement function
definitions.

@item
Fix bug resulting in debugger not knowing size of local equivalence
area when any member of area has initial value (via @samp{DATA},
for example).

@item
Fix installation bug that prevented installation of @code{g77} driver.
Provide for easy selection of whether to install copy of @code{g77}
as @code{f77} to replace the broken code.

@item
Fix @code{gcc} driver (affects @code{g77} thereby) to not
gratuitously invoke the
@code{f771} program (e.g. when @samp{-E} is specified).

@item
Fix diagnostic to point to correct source line when it immediately
follows an @samp{INCLUDE} statement.

@item
Support more compiler options in @code{gcc}/@code{g77} when
compiling Fortran files.
These options include @samp{-p}, @samp{-pg}, @samp{-aux-info}, @samp{-P},
correct setting of version-number macros for preprocessing, full
recognition of @samp{-O0}, and
automatic insertion of configuration-specific linker specs.

@item
Add new intrinsics that interface to existing routines in @code{libf2c}:
@samp{ABORT}, @samp{DERF}, @samp{DERFC}, @samp{ERF}, @samp{ERFC}, @samp{EXIT},
@samp{FLUSH}, @samp{GETARG}, @samp{GETENV}, @samp{IARGC},
@samp{SIGNAL}, and @samp{SYSTEM}.
Note that @samp{ABORT}, @samp{EXIT}, @samp{FLUSH}, @samp{SIGNAL}, and
@samp{SYSTEM} are intrinsic subroutines, not functions (since they
have side effects), so to get the return values from @samp{SIGNAL}
and @samp{SYSTEM}, append a final argument specifying an @samp{INTEGER}
variable or array element (e.g. @samp{CALL SYSTEM('rm foo',ISTAT)}).

@item
Add new intrinsic group named @samp{unix} to contain the new intrinsics,
and by default enable this new group.

@item
Move @samp{LOC()} intrinsic out of the @samp{vxt} group to the new
@samp{unix} group.

@item
Improve @code{g77} so that @samp{g77 -v} by itself (or with
certain other options, including @samp{-B}, @samp{-b}, @samp{-i},
@samp{-nostdlib}, and @samp{-V}) reports lots more useful
version info, and so that long-form options @code{gcc} accepts are
understood by @code{g77} as well (even in truncated, unambiguous forms).

@item
Add new @code{g77} option @samp{--driver=name} to specify driver when
default, @code{gcc}, isn't appropriate.

@item
Add support for @samp{#} directives (as output by the preprocessor) in the
compiler, and enable generation of those directives by the
preprocessor (when compiling @samp{.F} files) so diagnostics and debugging
info are more useful to users of the preprocessor.

@item
Produce better diagnostics, more like @code{gcc}, with info such as
@samp{In function `foo':} and @samp{In file included from...:}.

@item
Support @code{gcc}'s @samp{-fident} and @samp{-fno-ident} options.

@item
When @samp{-Wunused} in effect, don't warn about local variables used as
statement-function dummy arguments or @samp{DATA} implied-@samp{DO} iteration
variables, even though, strictly speaking, these are not uses
of the variables themselves.

@item
When @samp{-W -Wunused} in effect, don't warn about unused dummy arguments
at all, since there's no way to turn this off for individual
cases (@code{g77} might someday start warning about these)---applies
to @code{gcc} versions 2.7.0 and later, since earlier versions didn't
warn about unused dummy arguments.

@item
New option @samp{-fno-underscoring} that inhibits transformation of names
(by appending one or two underscores) so users may experiment
with implications of such an environment.

@item
Minor improvement to @file{gcc/f/info} module to make it easier to build
@code{g77} using the native (non-@code{gcc}) compiler on certain machines
(but definitely not all machines nor all non-@code{gcc} compilers).
Please
do not report bugs showing problems compilers have with
macros defined in @file{gcc/f/target.h} and used in places like
@file{gcc/f/expr.c}.

@item
Add warning to be printed for each invocation of the compiler
if the target machine @samp{INTEGER}, REAL, or @samp{LOGICAL} size
is not 32 bits,
since @code{g77} is known to not work well for such cases (to be
fixed in Version 0.6---).

@item
Lots of new documentation (though work is still needed to put it into
canonical GNU format).

@item
Build @code{libf2c} with @samp{-g0}, not @samp{-g2}, in effect
(by default), to produce
smaller library without lots of debugging clutter.
@end itemize

@heading In 0.5.15:
@itemize @bullet
@item
Fix bad code generation involving @samp{X**I} and temporary, internal variables
generated by @code{g77} and the back end (such as for @samp{DO} loops).

@item
Fix crash given @samp{CHARACTER A;DATA A/.TRUE./}.

@item
Replace crash with diagnostic given @samp{CHARACTER A;DATA A/1.0/}.

@item
Fix crash or other erratic behavior when null character constant
(@samp{''}) is encountered.

@item
Fix crash or other erratic behavior involving diagnosed code.

@item
Fix code generation for external functions returning type @samp{REAL} when
the @samp{-ff2c} option is in force (which it is by default) so that
@code{f2c} compatibility is indeed provided.

@item
Disallow @samp{COMMON I(10)} if @samp{I} has previously been specified
with an array declarator.

@item
New @samp{-ffixed-line-length-@var{n}} option, where @var{n} is the
maximum length
of a typical fixed-form line, defaulting to 72 columns, such
that characters beyond column @var{n} are ignored, or @var{n} is @samp{none},
meaning no characters are ignored.
does not affect lines
with @samp{&} in column 1, which are always processed as if
@samp{-ffixed-line-length-none} was in effect.

@item
No longer generate better code for some kinds of array references,
as @code{gcc} back end is to be fixed to do this even better, and it
turned out to slow down some code in some cases after all.

@item
In @samp{COMMON} and @samp{EQUIVALENCE} areas with any members given initial
values (e.g. via @samp{DATA}), uninitialized members now always
initialized to binary zeros (though this is not required by
the standard, and might not be done in future versions
of @code{g77}).
Previously, in some @samp{COMMON}/@samp{EQUIVALENCE} areas
(essentially those with members of more than one type), the
uninitialized members were initialized to spaces, to
cater to @samp{CHARACTER} types, but it seems no existing code expects
that, while much existing code expects binary zeros.
@end itemize

@heading In 0.5.14:
@itemize @bullet
@item
Don't emit bad code when low bound of adjustable array is nonconstant
and thus might vary as an expression at run time.

@item
Emit correct code for calculation of number of trips in @samp{DO} loops
for cases
where the loop should not execute at all.
(This bug affected cases
where the difference between the begin and end values was less
than the step count, though probably not for floating-point cases.)

@item
Fix crash when extra parentheses surround item in
@samp{DATA} implied-@samp{DO} list.

@item
Fix crash over minor internal inconsistencies in handling diagnostics,
just substitute dummy strings where necessary.

@item
Fix crash on some systems when compiling call to @samp{MVBITS()} intrinsic.

@item
Fix crash on array assignment @samp{TYPE@var{ddd}(...)=...}, where @var{ddd}
is a string of one or more digits.

@item
Fix crash on @samp{DCMPLX()} with a single @samp{INTEGER} argument.

@item
Fix various crashes involving code with diagnosed errors.

@item
Support @samp{-I} option for @samp{INCLUDE} statement, plus @code{gcc}'s
@file{header.gcc} facility for handling systems like MS-DOS.

@item
Allow @samp{INCLUDE} statement to be continued across multiple lines,
even allow it to coexist with other statements on the same line.

@item
Incorporate Bellcore fixes to @code{libf2c} through 1995-03-15---this
fixes a bug involving infinite loops reading EOF with empty list-directed
I/O list.

@item
Remove all the @code{g77}-specific auto-configuration scripts, code,
and so on,
except for temporary substitutes for bsearch() and strtoul(), as
too many configure/build problems were reported in these areas.
People will have to fix their systems' problems themselves, or at
least somewhere other than @code{g77}, which expects a working ANSI C
environment (and, for now, a GNU C compiler to compile @code{g77} itself).

@item
Complain if initialized common redeclared as larger in subsequent program
unit.

@item
Warn if blank common initialized, since its size can vary and hence
related warnings that might be helpful won't be seen.

@item
New @samp{-fbackslash} option, on by default, that causes @samp{\}
within @samp{CHARACTER}
and Hollerith constants to be interpreted a la GNU C.
Note that
this behavior is somewhat different from @samp{f2c}'s, which supports only
a limited subset of backslash (escape) sequences.

@item
Make @samp{-fugly-args} the default.

@item
New @samp{-fugly-init} option, on by default, that allows typeless/Hollerith
to be specified as initial values for variables or named constants
(@samp{PARAMETER}), and also allows character<->numeric conversion in
those contexts---turn off via @samp{-fno-ugly-init}.

@item
New @samp{-finit-local-zero} option to initialize
local variables to binary zeros.
This does not affect whether they are @samp{SAVE}d, i.e. made
automatic or static.

@item
New @samp{-Wimplicit} option to warn about implicitly typed variables, arrays,
and functions.
(Basically causes all program units to default to @samp{IMPLICIT NONE}.)

@item
@samp{-Wall} now implies @samp{-Wuninitialized} as with @code{gcc}
(i.e. unless @samp{-O} not specified, since @samp{-Wuninitialized}
requires @samp{-O}), and implies @samp{-Wunused} as well.

@item
@samp{-Wunused} no longer gives spurious messages for unused
@samp{EXTERNAL} names (since they are assumed to refer to block data
program units, to make use of libraries more reliable).

@item
Support @samp{%LOC()} and @samp{LOC()} of character arguments.

@item
Support null (zero-length) character constants and expressions.

@item
Support @code{f2c}'s @samp{IMAG()} generic intrinsic.

@item
Support @samp{ICHAR()}, @samp{IACHAR()}, and @samp{LEN()} of
character expressions that are valid in assignments but
not normally as actual arguments.

@item
Support @code{f2c}-style @samp{&} in column 1 to mean continuation line.

@item
Allow @samp{NAMELIST}, @samp{EXTERNAL}, @samp{INTRINSIC}, and @samp{VOLATILE}
in @samp{BLOCK DATA}, even though these are not allowed by the standard.

@item
Allow @samp{RETURN} in main program unit.

@item
Changes to Hollerith-constant support to obey Appendix C of the
standard:

@itemize --
@item
Now padded on the right with zeros, not spaces.

@item
Hollerith ``format specifications'' in the form of arrays of
non-character allowed.

@item
Warnings issued when non-blank truncation occurs when converting
to another type.

@item
When specified as actual argument, now passed
by reference to @samp{INTEGER} (padded on right with spaces if constant
too small, otherwise fully intact if constant wider the @samp{INTEGER}
type) instead of by value.
@end itemize

@strong{Warning:} @code{f2c} differs on the
interpretation of @samp{CALL FOO(1HX)}, which it treats exactly the
same as @samp{CALL FOO('X')}, but which the standard and @code{g77} treat
as @samp{CALL FOO(%REF('X   '))} (padded with as many blanks as necessary
to widen to @samp{INTEGER}), essentially.

@item
Changes and fixes to typeless-constant support:

@itemize --
@item
Now treated as a typeless double-length @samp{INTEGER} value.

@item
Warnings issued when overflow occurs.

@item
Padded on the left with zeros when converting
to a larger type.

@item
Should be properly aligned and ordered on
the target machine for whatever type it is turned into.

@item
When specified as actual argument, now passed as reference to
a default @samp{INTEGER} constant.
@end itemize

@item
@samp{%DESCR()} of a non-@samp{CHARACTER} expression now passes a pointer to
the expression plus a length for the expression just as if
it were a @samp{CHARACTER} expression.
For example, @samp{CALL FOO(%DESCR(D))}, where
@samp{D} is @samp{REAL*8}, is the same as @samp{CALL FOO(D,%VAL(8)))}.

@item
Name of multi-entrypoint master function changed to incorporate
the name of the primary entry point instead of a decimal
value, so the name of the master function for @samp{SUBROUTINE X}
with alternate entry points is now @samp{__g77_masterfun_x}.

@item
Remove redundant message about zero-step-count @samp{DO} loops.

@item
Clean up diagnostic messages, shortening many of them.

@item
Fix typo in @code{g77} man page.

@item
Clarify implications of constant-handling bugs in @file{f/BUGS}.

@item
Generate better code for @samp{**} operator with a right-hand operand of
type @samp{INTEGER}.

@item
Generate better code for @samp{SQRT()} and @samp{DSQRT()},
also when @samp{-ffast-math}
specified, enable better code generation for @samp{SIN()} and @samp{COS()}.

@item
Generate better code for some kinds of array references.

@item
Speed up lexing somewhat (this makes the compilation phase noticably
faster).
@end itemize
