Commit 1e4b1376 by Tobias Burnus Committed by Tobias Burnus

re PR fortran/50960 ([OOP] vtables not marked as constant)

2011-11-03  Tobias Burnus  <burnus@net-b.de>

        PR fortran/50960
        * trans-decl.c (gfc_finish_var_decl): Mark PARAMETER as
        * TREE_READONLY.

2011-11-03  Tobias Burnus  <burnus@net-b.de>

        PR fortran/50960
        * gfortran.dg/module_parameter_array_refs_2.f90: New.

From-SVN: r180878
parent 42d0058e
2011-11-03 Tobias Burnus <burnus@net-b.de>
PR fortran/50960
* trans-decl.c (gfc_finish_var_decl): Mark PARAMETER as TREE_READONLY.
2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
* trans.h (struct gfc_ss, struct gfc_ss_info): Move field
......
......@@ -517,6 +517,10 @@ gfc_finish_var_decl (tree decl, gfc_symbol * sym)
/* If it wasn't used we wouldn't be getting it. */
TREE_USED (decl) = 1;
if (sym->attr.flavor == FL_PARAMETER
&& (sym->attr.dimension || sym->ts.type == BT_DERIVED))
TREE_READONLY (decl) = 1;
/* Chain this decl to the pending declarations. Don't do pushdecl()
because this would add them to the current scope rather than the
function scope. */
......
2011-11-03 Tobias Burnus <burnus@net-b.de>
PR fortran/50960
* gfortran.dg/module_parameter_array_refs_2.f90: New.
2011-11-03 Richard Guenther <rguenther@suse.de>
PR middle-end/50079
......
! { dg-do compile }
! { dg-options "-O" }
! { dg-final { scan-assembler-not "i_am_optimized_away" } }
!
! PR fortran/50960
!
! PARAMETER arrays and derived types exists as static variables.
! Check that the their read-only nature is taken into account
! when optimizations are done.
!
module m
integer, parameter :: PARA(*) = [1,2,3,4,5,6,7,8,9,10]
end module m
subroutine test()
use m
integer :: i
i = 1
if (para(i) /= 1) call i_am_optimized_away()
end
! { dg-final { cleanup-modules "m" } }
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