public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "martin.diehl at kuleuven dot be" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/105687] New: non-contiguous data in assumed rank Date: Sun, 22 May 2022 08:00:11 +0000 [thread overview] Message-ID: <bug-105687-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105687 Bug ID: 105687 Summary: non-contiguous data in assumed rank Product: gcc Version: 12.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: martin.diehl at kuleuven dot be Target Milestone: --- Created attachment 53014 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53014&action=edit small reproducer When passing a strided array to a select-rank statement, the information that that data is non-contiguous is somehow lost. At least when further passing the data to an assumed-size function, the arriving data differs. Note: This might be related to bug 105674. This report illustrates the actual problem I've encountered (wrong data) while the other report shows intermediate results when trying to write a minimal reproducer. code ==== program test integer, dimension(2,2), target :: dim_2 integer, dimension(:,:), pointer :: strided integer :: i dim_2 = reshape([(i,i=1,size(dim_2))],shape(dim_2)) strided => dim_2(1:1,:) print*, 'is_contiguous(strided)', is_contiguous(strided) print*, 'is_contiguous((strided))', is_contiguous((strided)) print*, '' print*, 'call show(strided)' call show(strided,size(strided)) print*, 'call show((strided))' call show((strided),size((strided))) print*, 'call assumed_rank(strided)' call assumed_rank(strided) print*, 'call assumed_rank((strided))' call assumed_rank((strided)) contains subroutine assumed_rank(dataset) integer, intent(in), dimension(..) :: dataset select rank(dataset) rank(2) print*, 'is contiguous in select', is_contiguous(dataset) print*, 'data in select', dataset call show(dataset,size(dataset)) end select print*, '' end subroutine assumed_rank subroutine show(dataset,s) integer, intent(in) :: s integer, intent(in), dimension(*) :: dataset print*, 'is contiguous in show', is_contiguous(dataset) print*, 'data in show', dataset(1:s) print*, '' end subroutine show end program test output ====== is_contiguous(strided) F is_contiguous((strided)) T call show(strided) is contiguous in show T data in show 1 3 call show((strided)) is contiguous in show T data in show 1 3 call assumed_rank(strided) is contiguous in select T data in select 1 3 is contiguous in show T data in show 1 2 call assumed_rank((strided)) is contiguous in select T data in select 1 3 is contiguous in show T data in show 1 3
reply other threads:[~2022-05-22 8:00 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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-105687-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).