From dab2cbf8a0d2c4210b1e2f85c3309182992a9c43 Mon Sep 17 00:00:00 2001 From: Janus Weil Date: Tue, 18 Mar 2014 23:15:10 +0100 Subject: [PATCH] re PR fortran/55207 ([F08] Variables declared in the main program should implicitly get the SAVE attribute) 2014-03-18 Janus Weil PR fortran/55207 PR fortran/60549 * decl.c (match_attr_spec): Revert r208590. 2014-03-18 Janus Weil PR fortran/55207 PR fortran/60549 * gfortran.dg/assumed_rank_7.f90: Revert r208590. * gfortran.dg/c_ptr_tests_16.f90: Ditto. * gfortran.dg/inline_sum_bounds_check_1.f90: Ditto. * gfortran.dg/intent_optimize_1.f90: Ditto. * gfortran.dg/pointer_init_9.f90: Ditto. * gfortran.dg/volatile4.f90: Ditto. * gfortran.dg/volatile6.f90: Ditto. From-SVN: r208668 --- gcc/fortran/ChangeLog | 6 ++++++ gcc/fortran/decl.c | 8 +++----- gcc/testsuite/ChangeLog | 12 ++++++++++++ gcc/testsuite/gfortran.dg/assumed_rank_7.f90 | 2 -- gcc/testsuite/gfortran.dg/c_ptr_tests_16.f90 | 4 ++-- .../gfortran.dg/inline_sum_bounds_check_1.f90 | 4 ++-- gcc/testsuite/gfortran.dg/intent_optimize_1.f90 | 5 +---- gcc/testsuite/gfortran.dg/pointer_init_9.f90 | 14 -------------- gcc/testsuite/gfortran.dg/volatile4.f90 | 2 -- gcc/testsuite/gfortran.dg/volatile6.f90 | 2 -- 10 files changed, 26 insertions(+), 33 deletions(-) delete mode 100644 gcc/testsuite/gfortran.dg/pointer_init_9.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 78dbc5d38926..0386d1d936bb 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2014-03-18 Janus Weil + + PR fortran/55207 + PR fortran/60549 + * decl.c (match_attr_spec): Revert r208590. + 2014-03-18 Jakub Jelinek PR ipa/58721 diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index c7f5eed36824..2d405fe98380 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -3827,11 +3827,9 @@ match_attr_spec (void) } } - /* Since Fortran 2008, variables declared in a MODULE or PROGRAM - implicitly have the SAVE attribute. */ - if ((gfc_current_state () == COMP_MODULE - || gfc_current_state () == COMP_PROGRAM) - && !current_attr.save && (gfc_option.allow_std & GFC_STD_F2008) != 0) + /* Since Fortran 2008 module variables implicitly have the SAVE attribute. */ + if (gfc_current_state () == COMP_MODULE && !current_attr.save + && (gfc_option.allow_std & GFC_STD_F2008) != 0) current_attr.save = SAVE_IMPLICIT; colon_seen = 1; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ffb6112cc59d..0de4f716020c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,15 @@ +2014-03-18 Janus Weil + + PR fortran/55207 + PR fortran/60549 + * gfortran.dg/assumed_rank_7.f90: Revert r208590. + * gfortran.dg/c_ptr_tests_16.f90: Ditto. + * gfortran.dg/inline_sum_bounds_check_1.f90: Ditto. + * gfortran.dg/intent_optimize_1.f90: Ditto. + * gfortran.dg/pointer_init_9.f90: Ditto. + * gfortran.dg/volatile4.f90: Ditto. + * gfortran.dg/volatile6.f90: Ditto. + 2014-03-18 Manuel López-Ibáñez PR c/55383 diff --git a/gcc/testsuite/gfortran.dg/assumed_rank_7.f90 b/gcc/testsuite/gfortran.dg/assumed_rank_7.f90 index a5dc8157a4fe..f9ff3b9aa424 100644 --- a/gcc/testsuite/gfortran.dg/assumed_rank_7.f90 +++ b/gcc/testsuite/gfortran.dg/assumed_rank_7.f90 @@ -24,8 +24,6 @@ call bar(ac) call bar(at) if (i /= 12) call abort() -deallocate(ac,at) - contains subroutine bar(x) type(t) :: x(..) diff --git a/gcc/testsuite/gfortran.dg/c_ptr_tests_16.f90 b/gcc/testsuite/gfortran.dg/c_ptr_tests_16.f90 index 3602428a0ac1..8855d62abaac 100644 --- a/gcc/testsuite/gfortran.dg/c_ptr_tests_16.f90 +++ b/gcc/testsuite/gfortran.dg/c_ptr_tests_16.f90 @@ -3,7 +3,7 @@ ! ! PR fortran/46974 -subroutine test +program test use ISO_C_BINDING implicit none type(c_ptr) :: m @@ -15,7 +15,7 @@ subroutine test .and. int(z'41424345') /= a & .and. int(z'4142434500000000',kind=8) /= a) & call i_do_not_exist() -end subroutine +end program test ! Examples contributed by Steve Kargl and James Van Buskirk diff --git a/gcc/testsuite/gfortran.dg/inline_sum_bounds_check_1.f90 b/gcc/testsuite/gfortran.dg/inline_sum_bounds_check_1.f90 index 579e936624da..39984683d4bf 100644 --- a/gcc/testsuite/gfortran.dg/inline_sum_bounds_check_1.f90 +++ b/gcc/testsuite/gfortran.dg/inline_sum_bounds_check_1.f90 @@ -1,9 +1,9 @@ ! { dg-do run } -! { dg-options "-fbounds-check -Wno-aggressive-loop-optimizations" } +! { dg-options "-fbounds-check" } integer, parameter :: nx = 3, ny = 4 - integer :: i, too_big + integer :: i, j, too_big integer, parameter, dimension(nx,ny) :: p = & reshape((/ (i*i, i=1,size(p)) /), shape(p)) diff --git a/gcc/testsuite/gfortran.dg/intent_optimize_1.f90 b/gcc/testsuite/gfortran.dg/intent_optimize_1.f90 index 580db4284f93..dbe0128d7f0d 100644 --- a/gcc/testsuite/gfortran.dg/intent_optimize_1.f90 +++ b/gcc/testsuite/gfortran.dg/intent_optimize_1.f90 @@ -6,10 +6,7 @@ ! honoured. ! ! PR fortran/43665 - - -subroutine test - +! interface subroutine foo(x) integer, intent(in) :: x diff --git a/gcc/testsuite/gfortran.dg/pointer_init_9.f90 b/gcc/testsuite/gfortran.dg/pointer_init_9.f90 deleted file mode 100644 index 1b47135f627e..000000000000 --- a/gcc/testsuite/gfortran.dg/pointer_init_9.f90 +++ /dev/null @@ -1,14 +0,0 @@ -! { dg-do run } -! -! PR 55207: [F08] Variables declared in the main program should implicitly get the SAVE attribute -! -! Contributed by Tobias Burnus - - type :: c - end type c - - type(c), target :: x - class(c), pointer :: px => x - - if (.not. associated(px)) call abort() -end diff --git a/gcc/testsuite/gfortran.dg/volatile4.f90 b/gcc/testsuite/gfortran.dg/volatile4.f90 index 4ad09dcb5d70..f58a873dfb47 100644 --- a/gcc/testsuite/gfortran.dg/volatile4.f90 +++ b/gcc/testsuite/gfortran.dg/volatile4.f90 @@ -2,8 +2,6 @@ ! { dg-options "-O2 -fdump-tree-optimized" } ! Tests whether volatile really works ! PR fortran/29601 - -subroutine sub logical, volatile :: t1 logical :: t2 integer :: i diff --git a/gcc/testsuite/gfortran.dg/volatile6.f90 b/gcc/testsuite/gfortran.dg/volatile6.f90 index 439183a1794a..e42e3de3acbb 100644 --- a/gcc/testsuite/gfortran.dg/volatile6.f90 +++ b/gcc/testsuite/gfortran.dg/volatile6.f90 @@ -2,8 +2,6 @@ ! { dg-options "-O2 -fdump-tree-optimized" } ! Tests whether volatile really works for arrays ! PR fortran/29601 - -subroutine sub logical, allocatable, volatile :: t1(:) logical, allocatable :: t2(:) integer :: i -- 2.43.5