view gcc/testsuite/gfortran.dg/inquiry_type_ref_6.f90 @ 152:2b5abeee2509

update gcc11
author anatofuz
date Mon, 25 May 2020 07:50:57 +0900
parents
children
line wrap: on
line source

! { dg-do run }
! { dg-options "-fcheck=all" }
!
! Test the fix for PR93581 and the implementation of note 9.7 of F2018.
! The latter requires that the result of the LEN inquiry be a scalar
! even for array expressions.
!
! Contributed by Gerhard Steinmetz  <gscfq@t-online.de>
!
program p
   complex, target :: z(2) = [(1.0, 2.0),(3.0, 4.0)]
   character(:), allocatable, target :: c(:)
   real, pointer :: r(:)
   character(:), pointer :: s(:)

   r => z%re
   if (any (r .ne. real (z))) stop 1
   r => z%im
   if (any (r .ne. imag (z))) stop 2

   allocate (c, source = ['abc','def'])
   s(-2:-1) => c(1:2)
   if (s%len .ne. len (c)) stop 3
end