OSDN Git Service

fortran/
authortobi <tobi@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 10 Jul 2004 23:50:28 +0000 (23:50 +0000)
committertobi <tobi@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 10 Jul 2004 23:50:28 +0000 (23:50 +0000)
* trans-decl.c (gfc_create_module_variable): Nothing to do if
symbol is in common, because we ...
(gfc_generate_module_vars): Call gfc_trans_common.

testsuite/
* gfortran.fortran-torture/execute/common_2.f90: Add check for
access to common var from module.

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

gcc/fortran/ChangeLog
gcc/fortran/trans-decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.fortran-torture/execute/common_2.f90

index 813e7c0..39057f3 100644 (file)
@@ -1,3 +1,9 @@
+2004-07-10  Tobias Schlueter  <tobias.schlueter@physik.uni-muenchen.de>
+
+       * trans-decl.c (gfc_create_module_variable): Nothing to do if
+       symbol is in common, because we ...
+       (gfc_generate_module_vars): Call gfc_trans_common.
+
 2004-07-10  Paul Brook  <paul@codesourcery.com>
 
        * trans-array.c (gfc_build_null_descriptor): New function.
index b1b5120..4dce18a 100644 (file)
@@ -1798,8 +1798,9 @@ gfc_create_module_variable (gfc_symbol * sym)
       && (sym->attr.flavor != FL_PARAMETER || sym->attr.dimension == 0))
     return;
 
-  /* Don't generate variables from other modules.  */
-  if (sym->attr.use_assoc)
+  /* Don't generate variables from other modules. Variables from
+     COMMONs will already have been generated.  */
+  if (sym->attr.use_assoc || sym->attr.in_common)
     return;
 
   if (sym->backend_decl)
@@ -1867,6 +1868,9 @@ gfc_generate_module_vars (gfc_namespace * ns)
   /* Check if the frontend left the namespace in a reasonable state.  */
   assert (ns->proc_name && !ns->proc_name->tlink);
 
+  /* Generate COMMON blocks.  */
+  gfc_trans_common (ns);
+
   /* Create decls for all the module variables.  */
   gfc_traverse_ns (ns, gfc_create_module_variable);
 }
index 3d97823..99083c2 100644 (file)
@@ -1,4 +1,9 @@
 2004-07-10  Tobias Schlueter  <tobias.schlueter@physik.uni-muenchen.de>
+       
+       * gfortran.fortran-torture/execute/common_2.f90: Add check for
+       access to common var from module.
+
+2004-07-10  Tobias Schlueter  <tobias.schlueter@physik.uni-muenchen.de>
 
        PR fortran/16336
        * gfortran.fortran-torture/execute/common_2.f90: New test.
index fd7f762..8bcdbb8 100644 (file)
@@ -2,6 +2,10 @@
 MODULE bar
 INTEGER :: I
 COMMON /X/I
+contains 
+subroutine set_i()
+i = 5
+end subroutine set_i
 END MODULE bar
 
 USE bar
@@ -11,4 +15,6 @@ j = 1
 i = 2
 if (j.ne.i) call abort()
 if (j.ne.2) call abort()
+call set_i()
+if (j.ne.5) call abort()
 END