OSDN Git Service

PR fortran/20592
authorfxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 31 Aug 2005 12:31:30 +0000 (12:31 +0000)
committerfxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 31 Aug 2005 12:31:30 +0000 (12:31 +0000)
* 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@103671 138bc75d-0d04-0410-961f-82ee72b054a4

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

index fc306e6..a03d3df 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 8c4303b..ed9fcba 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 945c9f1..847ab29 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 29d4317..8cad234 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 c980499..8e8d6a8 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 ace5958..968d137 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;