public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "kargl at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/107874] merge not using all its arguments Date: Sun, 27 Nov 2022 01:03:20 +0000 [thread overview] Message-ID: <bug-107874-4-r9J0OV7V95@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-107874-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107874 kargl at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kargl at gcc dot gnu.org --- Comment #2 from kargl at gcc dot gnu.org --- John thanks for posting the bug. Harald, you are likely right the patch can be moved down. I'll programmed up the example from the Fortran 2018 standard, which works as expected. So, there is definitely something about a scalar mask choosing the actual argument before both are evaluated. program foo call bah contains subroutine bah logical, parameter :: t = .true., f = .false. logical, parameter :: mask(2,3)= reshape([t, f, f, f, t, t], [2,3]) integer tsrc(2,3), fsrc(2,3), res(2,3) ! ! Direct reference to merge ! tsrc = reshape([1, 2, 6, 4, 5, 6], [2,3]) fsrc = reshape([0, 7, 3, 4, 2, 8], [2,3]) res = 42 res = merge(tsrc, fsrc, mask) write(*,'(*(I0,1X))') res(1,:) ! Should be 1 3 5 write(*,'(*(I0,1X))') res(2,:) ! Should be 7 4 6 write(*,*) ! ! Load matrices via a function. ! res = 0 ! Clear res = merge(load('t'), load('f'), mask) ! Clear write(*,'(*(I0,1X))') res(1,:) ! Should be 1 3 5 write(*,'(*(I0,1X))') res(2,:) ! Should be 7 4 6 end subroutine bah function load(c) result(r) integer r(2,3) character, intent(in) :: c if (c == 't') then r = reshape([1, 2, 6, 4, 5, 6], [2,3]) print *, 'loaded t' else if (c == 'f') then r = reshape([0, 7, 3, 4, 2, 8], [2,3]) print *, 'loaded f' else stop 'whoops' end if end function load end program foo
next prev parent reply other threads:[~2022-11-27 1:03 UTC|newest] Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-11-26 4:57 [Bug fortran/107874] New: " john.harper at vuw dot ac.nz 2022-11-26 20:30 ` [Bug fortran/107874] " anlauf at gcc dot gnu.org 2022-11-27 1:03 ` kargl at gcc dot gnu.org [this message] 2022-11-27 20:00 ` anlauf at gcc dot gnu.org 2022-11-27 21:07 ` anlauf at gcc dot gnu.org 2022-11-27 21:24 ` sgk at troutmask dot apl.washington.edu 2022-11-28 20:07 ` anlauf at gcc dot gnu.org 2022-11-29 18:19 ` cvs-commit at gcc dot gnu.org 2022-12-01 20:28 ` anlauf at gcc dot gnu.org 2022-12-01 21:36 ` jvdelisle2 at gmail dot com 2022-12-01 21:55 ` anlauf at gcc dot gnu.org 2022-12-01 22:17 ` anlauf at gcc dot gnu.org 2022-12-01 23:46 ` jvdelisle at gcc dot gnu.org 2022-12-01 23:54 ` jvdelisle at gcc dot gnu.org 2022-12-02 0:34 ` jvdelisle at gcc dot gnu.org 2022-12-02 17:48 ` anlauf at gcc dot gnu.org 2022-12-02 19:44 ` jvdelisle at gcc dot gnu.org 2022-12-02 20:22 ` anlauf at gcc dot gnu.org 2022-12-02 20:50 ` john.harper at vuw dot ac.nz 2022-12-02 21:05 ` anlauf at gcc dot gnu.org 2022-12-02 21:26 ` anlauf at gcc dot gnu.org 2022-12-02 21:27 ` john.harper at vuw dot ac.nz 2022-12-02 21:35 ` cvs-commit at gcc dot gnu.org 2022-12-02 21:42 ` jvdelisle at gcc dot gnu.org 2022-12-07 21:22 ` anlauf 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-107874-4-r9J0OV7V95@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).