view gcc/testsuite/gfortran.dg/warn_target_lifetime_4.f90 @ 128:fe568345ddd5

fix CbC-example
author mir3636
date Wed, 11 Apr 2018 19:32:28 +0900
parents 04ced10e8804
children
line wrap: on
line source

! { dg-do compile }
! { dg-options "-Wtarget-lifetime" }
!
! PR fortran/81770: [5/6/7 Regression] Bogus warning: Pointer in pointer assignment might outlive the pointer target
!
! Contributed by Janus Weil <janus@gcc.gnu.org>

module m

   type t
      integer, allocatable :: l
   end type

contains

   subroutine sub(c_in, list)
      type(t), target, intent(in)  :: c_in
      integer, pointer, intent(out) :: list

      type(t), pointer :: container

      container => c_in

      list => container%l

   end subroutine

end