diff options
author | Tobias Burnus <burnus@net-b.de> | 2012-04-08 09:15:01 +0200 |
---|---|---|
committer | Tobias Burnus <burnus@gcc.gnu.org> | 2012-04-08 09:15:01 +0200 |
commit | 5af6fa0b38c481617551b96f1c82bbf25f2f35c8 (patch) | |
tree | 80a679b42b61006710ce22f8265f8c31de58b1cd /gcc/fortran | |
parent | aeb9270a9866be202cf3d9036f4f58de6a1de36e (diff) | |
download | gcc-5af6fa0b38c481617551b96f1c82bbf25f2f35c8.tar.gz |
re PR fortran/52751 (private module variable are not exported as local)
2012-04-08 Tobias Burnus <burnus@net-b.de>
PR fortran/52751
* trans-decl.c (gfc_finish_var_decl): Don't set TREE_PUBLIC
for PRIVATE module variables without C-binding label.
PR fortran/40973
* trans-decl.c (build_function_decl): Ditto for procedures.
2012-04-08 Tobias Burnus <burnus@net-b.de>
PR fortran/40973
PR fortran/52751
* gfortran.dg/public_private_module_2.f90: New.
From-SVN: r186223
Diffstat (limited to 'gcc/fortran')
-rw-r--r-- | gcc/fortran/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/fortran/trans-decl.c | 8 |
2 files changed, 14 insertions, 3 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 2b9b03caae8..02c43558aa3 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,12 @@ +2012-04-08 Tobias Burnus <burnus@net-b.de> + + PR fortran/52751 + * trans-decl.c (gfc_finish_var_decl): Don't set TREE_PUBLIC + for PRIVATE module variables without C-binding label. + + PR fortran/40973 + * trans-decl.c (build_function_decl): Ditto for procedures. + 2012-04-07 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/52893 diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index 8a1dd2ecd97..aec96aa75a2 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -539,7 +539,7 @@ gfc_finish_var_decl (tree decl, gfc_symbol * sym) if (sym->attr.cray_pointee) return; - if(sym->attr.is_bind_c == 1) + if(sym->attr.is_bind_c == 1 && sym->binding_label) { /* We need to put variables that are bind(c) into the common segment of the object file, because this is what C would do. @@ -565,7 +565,8 @@ gfc_finish_var_decl (tree decl, gfc_symbol * sym) /* TODO: Don't set sym->module for result or dummy variables. */ gcc_assert (current_function_decl == NULL_TREE || sym->result == sym); /* This is the declaration of a module variable. */ - TREE_PUBLIC (decl) = 1; + if (sym->attr.access != ACCESS_PRIVATE) + TREE_PUBLIC (decl) = 1; TREE_STATIC (decl) = 1; } @@ -1842,7 +1843,8 @@ build_function_decl (gfc_symbol * sym, bool global) DECL_EXTERNAL (fndecl) = 0; if (!current_function_decl - && !sym->attr.entry_master && !sym->attr.is_main_program) + && !sym->attr.entry_master && !sym->attr.is_main_program + && (sym->attr.access != ACCESS_PRIVATE || sym->binding_label)) TREE_PUBLIC (fndecl) = 1; attributes = add_attributes_to_decl (attr, NULL_TREE); |