Commit 58341a42 by Tobias Burnus Committed by Tobias Burnus

re PR fortran/54221 (Explicit private access specifier signals "unexpected…

re PR fortran/54221 (Explicit private access specifier signals "unexpected defined but not used [-Wunused-function]" warning)

2012-08-12  Tobias Burnus  <burnus@net-b.de>

        PR fortran/54221
        * trans-decl.c (gfc_finish_var_decl, build_function_decl):
        Fix setting private module vars/procs as TREE_PUBLIC(...) = 0.

2012-08-12  Tobias Burnus  <burnus@net-b.de>

        PR fortran/54221
        * vect/vect-gems.f90: Don't mark module vars as PRIVATE as
        they appear uninitialized on the RHS.
        * gfortran.dg/public_private_module_6.f90: New.

From-SVN: r190325
parent 46d2f0c2
2012-08-12 Tobias Burnus <burnus@net-b.de>
PR fortran/54221
* trans-decl.c (gfc_finish_var_decl, build_function_decl):
Fix setting private module vars/procs as TREE_PUBLIC(...) = 0.
2012-08-09 Tobias Burnus <burnus@net-b.de>
PR fortran/54199
......
......@@ -562,6 +562,12 @@ 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. */
if (sym->attr.access == ACCESS_UNKNOWN
&& (sym->ns->default_access == ACCESS_PRIVATE
|| (sym->ns->default_access == ACCESS_UNKNOWN
&& gfc_option.flag_module_private)))
sym->attr.access = ACCESS_PRIVATE;
if (sym->attr.access != ACCESS_PRIVATE || sym->attr.public_used)
TREE_PUBLIC (decl) = 1;
TREE_STATIC (decl) = 1;
......@@ -1839,6 +1845,12 @@ build_function_decl (gfc_symbol * sym, bool global)
the opposite of declaring a function as static in C). */
DECL_EXTERNAL (fndecl) = 0;
if (sym->attr.access == ACCESS_UNKNOWN && sym->module
&& (sym->ns->default_access == ACCESS_PRIVATE
|| (sym->ns->default_access == ACCESS_UNKNOWN
&& gfc_option.flag_module_private)))
sym->attr.access = ACCESS_PRIVATE;
if (!current_function_decl
&& !sym->attr.entry_master && !sym->attr.is_main_program
&& (sym->attr.access != ACCESS_PRIVATE || sym->binding_label
......
2012-08-12 Tobias Burnus <burnus@net-b.de>
PR fortran/54221
* vect/vect-gems.f90: Don't mark module vars as PRIVATE as
they appear uninitialized on the RHS.
* gfortran.dg/public_private_module_6.f90: New.
2012-08-11 Martin Jambor <mjambor@suse.cz>
PR fortran/48636
......
! { dg-do compile }
! { dg-options "-O1" }
!
! PR fortran/54221
!
! Check that the unused PRIVATE "aaaa" variable is optimized away
!
module m
private
integer, save :: aaaa
end module m
! { dg-final { scan-assembler-not "aaaa" } }
......@@ -5,9 +5,9 @@ MODULE UPML_mod
IMPLICIT NONE
PUBLIC UPMLupdateE
PRIVATE
!PUBLIC UPMLupdateE
!
!PRIVATE
real(kind=8), dimension(:,:,:), allocatable :: Dx_ilow
......
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