1@c Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
2@c This is part of the G77 manual.
3@c For copying conditions, see the file g77.texi.
4
5@c The text of this file appears in the file BUGS
6@c in the G77 distribution, as well as in the G77 manual.
7
8@c Keep this the same as the dates above, since it's used
9@c in the standalone derivations of this file (e.g. BUGS).
10@set copyrights-bugs 1995,1996,1997,1998,1999,2000,2001,2002,2004
11
12@set last-update-bugs 2004-05-18
13
14@ifset DOC-BUGS
15@include root.texi
16@c The immediately following lines apply to the BUGS file
17@c which is derived from this file.
18@emph{Note:} This file is automatically generated from the files
19@file{bugs0.texi} and @file{bugs.texi}.
20@file{BUGS} is @emph{not} a source file,
21although it is normally included within source distributions.
22
23This file lists known bugs in the @value{which-g77} version
24of the GNU Fortran compiler.
25Copyright (C) @value{copyrights-bugs} Free Software Foundation, Inc.
26You may copy, distribute, and modify it freely as long as you preserve
27this copyright notice and permission notice.
28
29@node Top,,, (dir)
30@chapter Known Bugs In GNU Fortran
31@end ifset
32
33@ifset DOC-G77
34@node Known Bugs
35@section Known Bugs In GNU Fortran
36@end ifset
37
38This section identifies bugs that @code{g77} @emph{users}
39might run into in the @value{which-g77} version
40of @code{g77}.
41This includes bugs that are actually in the @code{gcc}
42back end (GBE) or in @code{libf2c}, because those
43sets of code are at least somewhat under the control
44of (and necessarily intertwined with) @code{g77},
45so it isn't worth separating them out.
46
47@ifset DOC-G77
48For information on bugs in @emph{other} versions of @code{g77},
49see @ref{News,,News About GNU Fortran}.
50There, lists of bugs fixed in various versions of @code{g77}
51can help determine what bugs existed in prior versions.
52@end ifset
53
54@ifset DOC-BUGS
55For information on bugs in @emph{other} versions of @code{g77},
56see @file{@value{path-g77}/NEWS}.
57There, lists of bugs fixed in various versions of @code{g77}
58can help determine what bugs existed in prior versions.
59@end ifset
60
61@ifset DEVELOPMENT
62@emph{Warning:} The information below is still under development,
63and might not accurately reflect the @code{g77} code base
64of which it is a part.
65Efforts are made to keep it somewhat up-to-date,
66but they are particularly concentrated
67on any version of this information
68that is distributed as part of a @emph{released} @code{g77}.
69
70In particular, while this information is intended to apply to
71the @value{which-g77} version of @code{g77},
72only an official @emph{release} of that version
73is expected to contain documentation that is
74most consistent with the @code{g77} product in that version.
75@end ifset
76
77The following information was last updated on @value{last-update-bugs}:
78
79@itemize @bullet
80@item
81@code{g77} fails to warn about
82use of a ``live'' iterative-DO variable
83as an implied-DO variable
84in a @code{WRITE} or @code{PRINT} statement
85(although it does warn about this in a @code{READ} statement).
86
87@item
88Something about @code{g77}'s straightforward handling of
89label references and definitions sometimes prevents the GBE
90from unrolling loops.
91Until this is solved, try inserting or removing @code{CONTINUE}
92statements as the terminal statement, using the @code{END DO}
93form instead, and so on.
94
95@item
96Some confusion in diagnostics concerning failing @code{INCLUDE}
97statements from within @code{INCLUDE}'d or @code{#include}'d files.
98
99@cindex integer constants
100@cindex constants, integer
101@item
102@code{g77} assumes that @code{INTEGER(KIND=1)} constants range
103from @samp{-2**31} to @samp{2**31-1} (the range for
104two's-complement 32-bit values),
105instead of determining their range from the actual range of the
106type for the configuration (and, someday, for the constant).
107
108Further, it generally doesn't implement the handling
109of constants very well in that it makes assumptions about the
110configuration that it no longer makes regarding variables (types).
111
112Included with this item is the fact that @code{g77} doesn't recognize
113that, on IEEE-754/854-compliant systems, @samp{0./0.} should produce a NaN
114and no warning instead of the value @samp{0.} and a warning.
115
116@cindex compiler speed
117@cindex speed, of compiler
118@cindex compiler memory usage
119@cindex memory usage, of compiler
120@cindex large aggregate areas
121@cindex initialization, bug
122@cindex DATA statement
123@cindex statements, DATA
124@item
125@code{g77} uses way too much memory and CPU time to process large aggregate
126areas having any initialized elements.
127
128For example, @samp{REAL A(1000000)} followed by @samp{DATA A(1)/1/}
129takes up way too much time and space, including
130the size of the generated assembler file.
131
132Version 0.5.18 improves cases like this---specifically,
133cases of @emph{sparse} initialization that leave large, contiguous
134areas uninitialized---significantly.
135However, even with the improvements, these cases still
136require too much memory and CPU time.
137
138(Version 0.5.18 also improves cases where the initial values are
139zero to a much greater degree, so if the above example
140ends with @samp{DATA A(1)/0/}, the compile-time performance
141will be about as good as it will ever get, aside from unrelated
142improvements to the compiler.)
143
144Note that @code{g77} does display a warning message to
145notify the user before the compiler appears to hang.
146@ifset DOC-G77
147A warning message is issued when @code{g77} sees code that provides
148initial values (e.g. via @code{DATA}) to an aggregate area (@code{COMMON}
149or @code{EQUIVALENCE}, or even a large enough array or @code{CHARACTER}
150variable)
151that is large enough to increase @code{g77}'s compile time by roughly
152a factor of 10.
153
154This size currently is quite small, since @code{g77}
155currently has a known bug requiring too much memory
156and time to handle such cases.
157In @file{@value{path-g77}/data.c}, the macro
158@code{FFEDATA_sizeTOO_BIG_INIT_} is defined
159to the minimum size for the warning to appear.
160The size is specified in storage units,
161which can be bytes, words, or whatever, on a case-by-case basis.
162
163After changing this macro definition, you must
164(of course) rebuild and reinstall @code{g77} for
165the change to take effect.
166
167Note that, as of version 0.5.18, improvements have
168reduced the scope of the problem for @emph{sparse}
169initialization of large arrays, especially those
170with large, contiguous uninitialized areas.
171However, the warning is issued at a point prior to
172when @code{g77} knows whether the initialization is sparse,
173and delaying the warning could mean it is produced
174too late to be helpful.
175
176Therefore, the macro definition should not be adjusted to
177reflect sparse cases.
178Instead, adjust it to generate the warning when densely
179initialized arrays begin to cause responses noticeably slower
180than linear performance would suggest.
181@end ifset
182
183@cindex code, displaying main source
184@cindex displaying main source code
185@cindex debugging main source code
186@cindex printing main source
187@item
188When debugging, after starting up the debugger but before being able
189to see the source code for the main program unit, the user must currently
190set a breakpoint at @code{MAIN__} (or @code{MAIN___} or @code{MAIN_} if
191@code{MAIN__} doesn't exist)
192and run the program until it hits the breakpoint.
193At that point, the
194main program unit is activated and about to execute its first
195executable statement, but that's the state in which the debugger should
196start up, as is the case for languages like C.
197
198@cindex debugger
199@item
200Debugging @code{g77}-compiled code using debuggers other than
201@code{gdb} is likely not to work.
202
203Getting @code{g77} and @code{gdb} to work together is a known
204problem---getting @code{g77} to work properly with other
205debuggers, for which source code often is unavailable to @code{g77}
206developers, seems like a much larger, unknown problem,
207and is a lower priority than making @code{g77} and @code{gdb}
208work together properly.
209
210On the other hand, information about problems other debuggers
211have with @code{g77} output might make it easier to properly
212fix @code{g77}, and perhaps even improve @code{gdb}, so it
213is definitely welcome.
214Such information might even lead to all relevant products
215working together properly sooner.
216
217@cindex Alpha, support
218@cindex support, Alpha
219@item
220@code{g77} doesn't work perfectly on 64-bit configurations
221such as the Digital Semiconductor (``DEC'') Alpha.
222
223This problem is largely resolved as of version 0.5.23.
224
225@cindex padding
226@cindex structures
227@cindex common blocks
228@cindex equivalence areas
229@item
230@code{g77} currently inserts needless padding for things like
231@samp{COMMON A,IPAD} where @samp{A} is @code{CHARACTER*1} and @samp{IPAD}
232is @code{INTEGER(KIND=1)} on machines like x86,
233because the back end insists that @samp{IPAD}
234be aligned to a 4-byte boundary,
235but the processor has no such requirement
236(though it is usually good for performance).
237
238The @code{gcc} back end needs to provide a wider array
239of specifications of alignment requirements and preferences for targets,
240and front ends like @code{g77} should take advantage of this
241when it becomes available.
242
243@cindex complex performance
244@cindex aliasing
245@item
246The @code{libf2c} routines that perform some run-time
247arithmetic on @code{COMPLEX} operands
248were modified circa version 0.5.20 of @code{g77}
249to work properly even in the presence of aliased operands.
250
251While the @code{g77} and @code{netlib} versions of @code{libf2c}
252differ on how this is accomplished,
253the main differences are that we believe
254the @code{g77} version works properly
255even in the presence of @emph{partially} aliased operands.
256
257However, these modifications have reduced performance
258on targets such as x86,
259due to the extra copies of operands involved.
260@end itemize
261