Bug 47057 - Unitialized variables not found by g77 when -fno-automatic is used
Summary: Unitialized variables not found by g77 when -fno-automatic is used
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gcc
Version: 7.1
Hardware: i386
OS: Linux
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: David Lawrence
Keywords: FutureFeature
Depends On:
TreeView+ depends on / blocked
Reported: 2001-07-02 20:14 UTC by Alfredo Ferrari
Modified: 2007-04-18 16:34 UTC (History)
0 users

Clone Of:
Last Closed: 2001-07-02 20:15:44 UTC

Attachments (Terms of Use)
tar file containing one script and 3 short fortran examples (407 bytes, text/plain)
2001-07-02 20:15 UTC, Alfredo Ferrari
no flags Details

Description Alfredo Ferrari 2001-07-02 20:14:12 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.77 [en] (X11; U; Linux 2.4.3-12 i686)

Description of problem:
Compiling a fortran code with obviously uninitialized variables under the
-Wall option should result in warning messages. Indeed this is true in many
cases, but the same exact code with the -fno-automatic
option does no longer give any warning (wrong of course). This is true
also if the SAVE statement is put into the code (this is consistent since
SAVE should perform the same as -fno-automatic)

The attached tar file contains a script, dobug, and two extremely short
fortran examples showing the problem

How reproducible:

Steps to Reproduce:
1.untar the example
2.run dobug
3.look at the results

Actual Results:  no warning is issued for the second and third examples,
while both should result in the same warnings as of the first example.
The 4th example (bug3.f) reults in only two warnings out of the required 4,
showing that all variables which are SAVEd are for some reason no longer
subject to the checks about initialization

Expected Results:  all four examples should issue warnings about all non
initialized variables

Additional info:

the problem is particular nasty when compiling large codes where the
-fno-automatic option is required or where anyway some variables must be
SAVEd. In the present version, g77 systematically misses unitialized
variables with obvious consequences. The problem bubbled up when the same
code was compiled under IM-AIX and Compaq TrueUnix
or whatever is now the name of Digital Unix, which both exposed some typos
which went unobserved under RH7.1.

Comment 1 Alfredo Ferrari 2001-07-02 20:15:41 UTC
Created attachment 22488 [details]
tar file containing one script and 3 short fortran examples

Comment 2 Jakub Jelinek 2001-07-25 15:11:10 UTC
All of egcs, g77 2.95.2, g77 2.96-RH, g77 3.0 and g77 3.1 CVS behave this way
(well, the variables are not uninitialized in that case, they are initialized
to 0). I don't know Fortran at all, so I have no idea what the standard
sais about it.
If you really think this should result in a warning, please talk to
Toon Moene <toon@moene.indiv.nluug.nl>, who is gcc Fortran maintainer.

Note You need to log in before you can comment on or make changes to this bug.