diff options
author | Tobias Schlüter <tobias.schlueter@physik.uni-muenchen.de> | 2004-08-30 21:08:41 +0200 |
---|---|---|
committer | Tobias Schlüter <tobi@gcc.gnu.org> | 2004-08-30 21:08:41 +0200 |
commit | 0de4325e0bc2e0601e49ac8e85ca9a7134e50198 (patch) | |
tree | f2545b671e60fba92c46ecb37aaa32965b1784a7 /gcc/fortran/trans-decl.c | |
parent | 442c8e31f0c70473592cbb205ca2d3ebc5cb69ae (diff) | |
download | gcc-0de4325e0bc2e0601e49ac8e85ca9a7134e50198.tar.gz |
gfortran.h (gfc_namespace): Add new field is_block_data.
fortran/
* gfortran.h (gfc_namespace): Add new field is_block_data.
* parse.c (accept_statement): Remove special handling for BLOCK DATA.
(parse_block_data): Record BLOCK DATA name, set is_block_data field.
* trans.c (gfc_generate_code): Handle BLOCK DATA units.
* trans.h (gfc_generate_block_data): Add prototype.
* trans-decl.c (gfc_generate_block_data): New function.
testsuite/
* gfortran.dg/blockdata_1.f90: New test.
From-SVN: r86796
Diffstat (limited to 'gcc/fortran/trans-decl.c')
-rw-r--r-- | gcc/fortran/trans-decl.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index 9f6af8efc58..44ddb656dd8 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -2350,4 +2350,30 @@ gfc_generate_constructors (void) #endif } +/* Translates a BLOCK DATA program unit. This means emitting the + commons contained therein plus their initializations. We also emit + a globally visible symbol to make sure that each BLOCK DATA program + unit remains unique. */ + +void +gfc_generate_block_data (gfc_namespace * ns) +{ + tree decl; + tree id; + + gfc_trans_common (ns); + + if (ns->proc_name) + id = gfc_sym_mangled_function_id (ns->proc_name); + else + id = get_identifier ("__BLOCK_DATA__"); + + decl = build_decl (VAR_DECL, id, gfc_array_index_type); + TREE_PUBLIC (decl) = 1; + TREE_STATIC (decl) = 1; + + pushdecl (decl); + rest_of_decl_compilation (decl, 1, 0); +} + #include "gt-fortran-trans-decl.h" |