Commit 9cbf8b41 by Tobias Schlüter Committed by Tobias Schlüter

trans-decl.c (gfc_create_module_variable): Nothing to do if symbol is in common, because we ...

fortran/
* 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.

From-SVN: r84479
parent a53334a4
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> 2004-07-10 Paul Brook <paul@codesourcery.com>
* trans-array.c (gfc_build_null_descriptor): New function. * trans-array.c (gfc_build_null_descriptor): New function.
......
...@@ -1798,8 +1798,9 @@ gfc_create_module_variable (gfc_symbol * sym) ...@@ -1798,8 +1798,9 @@ gfc_create_module_variable (gfc_symbol * sym)
&& (sym->attr.flavor != FL_PARAMETER || sym->attr.dimension == 0)) && (sym->attr.flavor != FL_PARAMETER || sym->attr.dimension == 0))
return; return;
/* Don't generate variables from other modules. */ /* Don't generate variables from other modules. Variables from
if (sym->attr.use_assoc) COMMONs will already have been generated. */
if (sym->attr.use_assoc || sym->attr.in_common)
return; return;
if (sym->backend_decl) if (sym->backend_decl)
...@@ -1867,6 +1868,9 @@ gfc_generate_module_vars (gfc_namespace * ns) ...@@ -1867,6 +1868,9 @@ gfc_generate_module_vars (gfc_namespace * ns)
/* Check if the frontend left the namespace in a reasonable state. */ /* Check if the frontend left the namespace in a reasonable state. */
assert (ns->proc_name && !ns->proc_name->tlink); assert (ns->proc_name && !ns->proc_name->tlink);
/* Generate COMMON blocks. */
gfc_trans_common (ns);
/* Create decls for all the module variables. */ /* Create decls for all the module variables. */
gfc_traverse_ns (ns, gfc_create_module_variable); gfc_traverse_ns (ns, gfc_create_module_variable);
} }
......
2004-07-10 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de> 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 PR fortran/16336
* gfortran.fortran-torture/execute/common_2.f90: New test. * gfortran.fortran-torture/execute/common_2.f90: New test.
......
...@@ -2,6 +2,10 @@ ...@@ -2,6 +2,10 @@
MODULE bar MODULE bar
INTEGER :: I INTEGER :: I
COMMON /X/I COMMON /X/I
contains
subroutine set_i()
i = 5
end subroutine set_i
END MODULE bar END MODULE bar
USE bar USE bar
...@@ -11,4 +15,6 @@ j = 1 ...@@ -11,4 +15,6 @@ j = 1
i = 2 i = 2
if (j.ne.i) call abort() if (j.ne.i) call abort()
if (j.ne.2) call abort() if (j.ne.2) call abort()
call set_i()
if (j.ne.5) call abort()
END END
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment