view gcc/testsuite/gfortran.dg/contiguous_7.f90 @ 144:8f4e72ab4e11

fix segmentation fault caused by nothing next cur_op to end
author Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Sun, 23 Dec 2018 21:23:56 +0900
parents 84e7813d76e9
children
line wrap: on
line source

! { dg-do compile }
! { dg-additional-options "-Wextra" }
!
! Ensure that contiguous pointers pointing to noncontiguous pointers
! to array results in a warning with -Wextra.

program cont_01_neg
  implicit none
  real, pointer, contiguous :: r(:)
  real, pointer, contiguous :: r2(:,:)
  real, target :: x(45)
  real, target :: x2(5,9)
  integer :: i
  integer :: n=1

  x = (/ (real(i),i=1,45) /)
  x2 = reshape(x,shape(x2))
  r => x(::3) ! { dg-warning "ssignment to contiguous pointer from non-contiguous target" }
  r2 => x2(2:,:) ! { dg-warning "ssignment to contiguous pointer from non-contiguous target" }
  r2 => x2(:,2:3)
  r => x2(2:3,1)
  r => x(::1)
  r => x(::n) ! { dg-warning "ssignment to contiguous pointer from non-contiguous target" }
end program