This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch, Fortran, F08] PR 55207: Variables declared in the main program should implicitly get the SAVE attribute


Hi all,

attached is a patch which implicitly sets the SAVE attribute for all
variables in the main program, as demanded by the Fortran 2008
standard. This fixes an ICE with pointer initialization (see
pointer_init_9.f90). Also a few exisiting test cases had to be changed
to accomodate for the modified behavior.

Regtests cleanly on x86_64-unknown-linux-gnu. Ok for trunk or wait for
next stage1?

Cheers,
Janus



2014-03-14  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/55207
    * decl.c (match_attr_spec): Variables in the main program implicitly
    get the SAVE attribute in Fortran 2008.


2014-03-14  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/55207
    * gfortran.dg/assumed_rank_7.f90: Explicitly deallocate variables.
    * gfortran.dg/c_ptr_tests_16.f90: Put into subroutine.
    * gfortran.dg/inline_sum_bounds_check_1.f90: Add
    -Wno-aggressive-loop-optimizations and remove an unused variable.
    * gfortran.dg/intent_optimize_1.f90: Put into subroutine.
    * gfortran.dg/pointer_init_9.f90: New.
    * gfortran.dg/volatile4.f90: Put into subroutine.
    * gfortran.dg/volatile6.f90: New.

Attachment: pr55207.diff
Description: Text document

! { dg-do run }
!
! PR 55207: [F08] Variables declared in the main program should implicitly get the SAVE attribute
!
! Contributed by Tobias Burnus <burnus@gcc.gnu.org>

  type :: c
  end type c

  type(c), target :: x
  class(c), pointer :: px => x

  if (.not. associated(px)) call abort()
end

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]