public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "igor.gayday at mu dot edu" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/97045] New: A wrong column is selected when addressing individual elements of unlimited polymorphic dummy argument Date: Mon, 14 Sep 2020 14:45:03 +0000 [thread overview] Message-ID: <bug-97045-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97045 Bug ID: 97045 Summary: A wrong column is selected when addressing individual elements of unlimited polymorphic dummy argument Product: gcc Version: 10.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: igor.gayday at mu dot edu Target Milestone: --- Consider the following Fortran program: program test_prg implicit none integer :: i integer, allocatable :: arr(:, :) arr = reshape([(i, i = 1, 100)], [10, 10]) do i = 1, 3 print *, 'Column', i call write_array(arr(1:2, i)) end do contains subroutine write_array(array) class(*), intent(in) :: array(:) integer :: i do i = 1, size(array) select type (elem => array(i)) type is (integer) print '(I0)', elem end select end do end subroutine subroutine write_array_alt(array) class(*), intent(in) :: array(:) integer :: i select type (array) type is (integer) print '(I0)', array end select end subroutine end program Compiled with gfortran 9.3.0 (and 10.2), the program prints: Column 1 1 2 Column 2 21 22 Column 3 41 42 As you can see, it skips every other column. If I replace the call to write_array with the call to write_array_alt, where I select type of the whole array and not individual elements, then every column is printed, as expected. This issue was originally reported here: https://stackoverflow.com/questions/63841012/a-wrong-column-is-selected-when-addressing-individual-elements-of-unlimited-poly
next reply other threads:[~2020-09-14 14:45 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-09-14 14:45 igor.gayday at mu dot edu [this message] 2020-09-20 16:57 ` [Bug fortran/97045] " pault at gcc dot gnu.org 2020-09-25 15:34 ` pault at gcc dot gnu.org 2020-09-30 12:44 ` cvs-commit at gcc dot gnu.org 2023-10-30 19:42 ` anlauf at gcc dot gnu.org 2023-10-31 7:32 ` pault 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-97045-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).