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

            Bug ID: 125998
           Summary: Wrong shape/bounds for TRANSPOSE() passed to a
                    CONTIGUOUS dummy argument
           Product: gcc
           Version: 16.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: federico.perini at gmail dot com
  Target Milestone: ---

MWE: 

program p
    real(8) :: a(3,4)
    integer :: dims(2)           
    character(48) :: iomsg  
    call show(transpose(a),dims)
    if (any(dims/=shape(transpose(a)))) then 
        write(iomsg,1) 'invalid a^T dims',dims, &
                       ' should be',shape(transpose(a))
        error stop iomsg
    endif
    1 format(*(a,' [',i0,',',i0,']'))

contains

    subroutine show(x,dims)
        ! "3 4" with `contiguous` (BUG); "4 3" without
        real(8), intent(in), target, contiguous :: x(:,:)
        integer, intent(out) :: dims(2)    
        dims = [size(x,1),size(x,2)]
    end 

end

Reply via email to