mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-23 01:50:33 +08:00
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
This commit is contained in:
parent
42d0058e49
commit
1e4b137661
@ -1,3 +1,8 @@
|
||||
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. */
|
||||
|
@ -1,3 +1,8 @@
|
||||
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
|
||||
|
23
gcc/testsuite/gfortran.dg/module_parameter_array_refs_2.f90
Normal file
23
gcc/testsuite/gfortran.dg/module_parameter_array_refs_2.f90
Normal file
@ -0,0 +1,23 @@
|
||||
! { 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" } }
|
Loading…
x
Reference in New Issue
Block a user