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
This commit is contained in:
Tobias Schlüter 2004-07-11 01:50:28 +02:00 committed by Tobias Schlüter
parent a53334a410
commit 9cbf8b4131
4 changed files with 23 additions and 2 deletions

View 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.

View 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);
}

View File

@ -1,3 +1,8 @@
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

View 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