https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83416

--- Comment #4 from Harald Anlauf <anlauf at gmx dot de> ---
(In reply to Thomas Koenig from comment #3)
> gfortran intentionally rejects such code.

I'm not convinced that this is correct.

The following code works with Cray, Intel and NAG in the way I expect it:

program gfcbug141d
  implicit none
  integer :: z(10)
  call foo (z)
  call foo (z(::2))
contains
  subroutine foo (x)
    integer, target              :: x(:)
    integer, pointer, contiguous :: a(:)
    integer, pointer             :: y(:)
    if (is_contiguous (x)) then
       print *, "Dummy argument x is contiguous"
       a => x
    else
       print *, "Dummy argument x is NOT contiguous"
       allocate (y(42))  ! Contiguous by 8.5.7 par. 2 items (5),(6)
       print *, "Temporary y is contiguous:", is_contiguous (y)
       a => y
    end if
  end subroutine foo
end program gfcbug141d

They print:

 Dummy argument x is contiguous
 Dummy argument x is NOT contiguous
 Temporary y is contiguous: T

BTW: gfortran lacks is_contiguous.

I'm not reopening now, I'll leave that for you or others if you change your
mind.

Reply via email to