public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/112371] New: Wrong upper bound for the result of reduction intrinsics if the array is empty
@ 2023-11-03 15:23 mikael at gcc dot gnu.org
  2023-11-03 15:28 ` [Bug fortran/112371] " mikael at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: mikael at gcc dot gnu.org @ 2023-11-03 15:23 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 112371
           Summary: Wrong upper bound for the result of reduction
                    intrinsics if the array is empty
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mikael at gcc dot gnu.org
  Target Milestone: ---

In the following example, I expect the ubound to be (/ 3, 0, 7 /), but the
printed values are (/ 0, 0, 7 /).


program p
  implicit none
  call check_iparity
  call check_sum
  call check_minloc
contains
  subroutine check_iparity
    integer :: a(9,3,0,7)
    integer :: i
    integer, allocatable :: r(:,:,:)
    i = 1
    a = reshape((/ integer:: /), shape(a))
    r = iparity(a, dim=i)
    print *, shape(r)
    print *, ubound(r)
!    if (any(shape(r) /= (/ 3, 0, 7 /))) stop 11
!    if (any(ubound(r) /= (/ 3, 0, 7 /))) stop 13
  end subroutine
  subroutine check_sum
    integer :: a(9,3,0,7)
    integer :: i
    integer, allocatable :: r(:,:,:)
    i = 1
    a = reshape((/ integer:: /), shape(a))
    r = sum(a, dim=i)
    print *, shape(r)
    print *, ubound(r)
!    if (any(shape(r) /= (/ 3, 0, 7 /))) stop 21
!    if (any(ubound(r) /= (/ 3, 0, 7 /))) stop 23
  end subroutine
  subroutine check_minloc
    integer :: a(9,3,0,7)
    integer :: i
    integer, allocatable :: r(:,:,:)
    i = 1
    a = reshape((/ integer:: /), shape(a))
    r = minloc(a, dim=i)
    print *, shape(r)
    print *, ubound(r)
!    if (any(shape(r) /= (/ 3, 0, 7 /))) stop 31
!    if (any(ubound(r) /= (/ 3, 0, 7 /))) stop 33
  end subroutine
end program

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-11-08 11:36 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-03 15:23 [Bug fortran/112371] New: Wrong upper bound for the result of reduction intrinsics if the array is empty mikael at gcc dot gnu.org
2023-11-03 15:28 ` [Bug fortran/112371] " mikael at gcc dot gnu.org
2023-11-03 15:31 ` mikael at gcc dot gnu.org
2023-11-03 15:56 ` mikael at gcc dot gnu.org
2023-11-08 11:04 ` [Bug libfortran/112371] " mikael at gcc dot gnu.org
2023-11-08 11:32 ` cvs-commit at gcc dot gnu.org
2023-11-08 11:32 ` cvs-commit at gcc dot gnu.org
2023-11-08 11:36 ` mikael at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).