public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "mikael at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/112371] New: Wrong upper bound for the result of reduction intrinsics if the array is empty Date: Fri, 03 Nov 2023 15:23:33 +0000 [thread overview] Message-ID: <bug-112371-4@http.gcc.gnu.org/bugzilla/> (raw) 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
next reply other threads:[~2023-11-03 15:23 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-11-03 15:23 mikael at gcc dot gnu.org [this message] 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
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-112371-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).