re PR fortran/20592 (-fno-automatic (g77 option) is missing from gfortran.)
authorFrancois-Xavier Coudert <coudert@clipper.ens.fr>
Wed, 31 Aug 2005 12:31:30 +0000 (14:31 +0200)
committerFrançois-Xavier Coudert <fxcoudert@gcc.gnu.org>
Wed, 31 Aug 2005 12:31:30 +0000 (12:31 +0000)
PR fortran/20592
* gfortran.h (gfc_option_t): Add flag_automatic.
* invoke.texi: Document the -fno-automatic option.
* lang.opt: Add a -fautomatic option.
* options.c (gfc_init_options): Default for -fautomatic is on.
(gfc_handle_option): Add handling of -fautomatic option.
* resolve.c (gfc_resolve): When -fno-automatic is used, mark
needed variables as SAVE.

From-SVN: r103671

gcc/fortran/ChangeLog
gcc/fortran/gfortran.h
gcc/fortran/invoke.texi
gcc/fortran/lang.opt
gcc/fortran/options.c
gcc/fortran/resolve.c

index fc306e692bf11a87ecb282545971488bdd4cea8f..a03d3dff6fc618179f666e33f7253c499b5d724d 100644 (file)
@@ -1,3 +1,14 @@
+2005-08-31  Francois-Xavier Coudert  <coudert@clipper.ens.fr>
+
+       PR fortran/20592
+       * gfortran.h (gfc_option_t): Add flag_automatic.
+       * invoke.texi: Document the -fno-automatic option.
+       * lang.opt: Add a -fautomatic option.
+       * options.c (gfc_init_options): Default for -fautomatic is on.
+       (gfc_handle_option): Add handling of -fautomatic option.
+       * resolve.c (gfc_resolve): When -fno-automatic is used, mark
+       needed variables as SAVE.
+
 2005-08-27  Erik Edelmann  <erik.edelmann@iki.fi>
 
        * trans-array.c (gfc_trans_deferred_array): Fix comments.
index 8c4303b1e15126457e5d913f5d3f7042ef2dd65b..ed9fcba819f6ee885580320366873a062155b014 100644 (file)
@@ -1438,6 +1438,7 @@ typedef struct
   int flag_pack_derived;
   int flag_repack_arrays;
   int flag_f2c;
+  int flag_automatic;
   int flag_backslash;
   int flag_d_lines;
 
index 945c9f1f7e5ce88284f18a0e5505f115fcf51d05..847ab29f70107e4cdc4870bf4c99ebcd02563029 100644 (file)
@@ -143,7 +143,7 @@ by type.  Explanations are in the following sections.
 @item Code Generation Options
 @xref{Code Gen Options,,Options for Code Generation Conventions}.
 @gccoptlist{
--ff2c -fno-underscoring  -fsecond-underscore @gol
+-fno-automatic -ff2c -fno-underscoring  -fsecond-underscore @gol
 -fbounds-check  -fmax-stack-var-size=@var{n} @gol
 -fpackderived  -frepack-arrays}
 @end table
@@ -537,8 +537,17 @@ one of the forms is listed---the one which is not the default.  You
 can figure out the other form by either removing @option{no-} or adding
 it.
 
-
 @table @gcctabopt
+@cindex @option{-fno-automatic} option
+@cindex options, @option{-fno-automatic}
+@item -fno-automatic
+@cindex SAVE statement
+@cindex statements, SAVE
+Treat each program unit as if the @code{SAVE} statement was specified for
+every local variable and array referenced in it. Does not affect common
+blocks. (Some Fortran compilers provide this option under the name
+@option{-static}.)
+
 @cindex @option{-ff2c} option
 @cindex options, @option{-ff2c}
 @item -ff2c
index 29d4317029aa264587684ae2420d4c7b77922014..8cad2349b615306b88317a3439247fc2f8fd0d0a 100644 (file)
@@ -69,6 +69,10 @@ Wunused-labels
 F95
 Warn when a label is unused
 
+fautomatic
+F95
+Do not treat local variables and COMMON blocks as if they were named in SAVE statements
+
 fbackslash
 F95
 Specify that backslash in string introduces an escape character
index c98049922e6a8a596e128d3df2a88388144d6cf2..8e8d6a889e017b267e55a09cca5648938e9b6bfe 100644 (file)
@@ -70,6 +70,7 @@ gfc_init_options (unsigned int argc ATTRIBUTE_UNUSED,
   gfc_option.flag_no_backend = 0;
   gfc_option.flag_pack_derived = 0;
   gfc_option.flag_repack_arrays = 0;
+  gfc_option.flag_automatic = 1;
   gfc_option.flag_backslash = 1;
   gfc_option.flag_d_lines = -1;
 
@@ -331,6 +332,10 @@ gfc_handle_option (size_t scode, const char *arg, int value)
       gfc_option.flag_dollar_ok = value;
       break;
 
+    case OPT_fautomatic:
+      gfc_option.flag_automatic = value;
+      break;
+
     case OPT_fbackslash:
       gfc_option.flag_backslash = value;
       break;
index ace59588991f6826c9ab4f0e41ddfd311a4729c8..968d137c44087601e46e6a5f7cdc5f2a6ad7eafc 100644 (file)
@@ -5053,7 +5053,7 @@ gfc_resolve (gfc_namespace * ns)
 
   gfc_traverse_ns (ns, resolve_values);
 
-  if (ns->save_all)
+  if (!gfc_option.flag_automatic || ns->save_all)
     gfc_save_all (ns);
 
   iter_stack = NULL;