public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "burnus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/47844] I/O: data transfer statement: Array stride ignored for pointer-valued function results Date: Tue, 22 Feb 2011 15:35:00 -0000 [thread overview] Message-ID: <bug-47844-4-ee8sAbBhCB@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-47844-4@http.gcc.gnu.org/bugzilla/> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47844 Tobias Burnus <burnus at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |pault at gcc dot gnu.org Summary|Pointer-valued function: |I/O: data transfer |Provide wrong result when |statement: Array stride |dereferenced automatically |ignored for pointer-valued |after list-write |function results --- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-02-22 14:45:42 UTC --- Paul, I added you as you are a tad more familiar with the scalarizer than I am. * * * Slightly simplified test case: integer, target :: tgt(5) = [1,2,3,4,5] integer, pointer :: ptr(:) print *, f(tgt) contains function f(x) integer, target :: x(:) integer, pointer :: f(:) f => x(::2) end function f end While "f" correctly sets the stride, it is ignored by the PRINT statement; -fdump-tree-original shows: f (&atmp.8, D.1566); [...] D.1579 = (*(integer(kind=4)[0:] * restrict) atmp.8.data)[S.9]; _gfortran_transfer_integer_write (&dt_parm.5, &D.1579, 4); } S.9 = S.9 + 1; The last line should be S.9 = S.9 + atmp.8.stride, which gets correctly set by "f()". Thus, one needs to teach the scalarizer that the stride does not have to be always 1 for SS_FUNCTION, though the only case I currently can come up with are array-valued pointer-returning functions. I think one should consider adding a is_pointer_result:1 to gfc_ss, which could be set in gfc_walk_function_expr. The scalarizers are set up via gfc_trans_transfer. The "1" setting seems to happen in gfc_conv_ss_startstride: case GFC_SS_CONSTRUCTOR: case GFC_SS_FUNCTION: for (n = 0; n < ss->data.info.dimen; n++) { ss->data.info.start[n] = gfc_index_zero_node; ss->data.info.end[n] = gfc_index_zero_node; ss->data.info.stride[n] = gfc_index_one_node; } break; At some point, it needs to be modified for array-pointer-returning functions; I think that should happen in gfc_conv_loop_setup
next prev parent reply other threads:[~2011-02-22 14:46 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-02-22 7:07 [Bug fortran/47844] New: Pointer-valued function: Provide wrong result when dereferenced automatically after list-write Kdx1999 at gmail dot com 2011-02-22 8:37 ` [Bug fortran/47844] " burnus at gcc dot gnu.org 2011-02-22 15:35 ` burnus at gcc dot gnu.org [this message] 2011-03-01 13:20 ` [Bug fortran/47844] Array stride ignored for pointer-valued function results burnus at gcc dot gnu.org 2011-10-05 10:02 ` dominiq at lps dot ens.fr 2011-10-05 10:22 ` pault at gcc dot gnu.org 2011-10-05 14:36 ` paul.richard.thomas at gmail dot com 2011-10-05 15:04 ` burnus at gcc dot gnu.org 2011-10-05 21:40 ` dominiq at lps dot ens.fr 2011-10-05 22:20 ` pault at gcc dot gnu.org 2011-10-08 10:19 ` pault at gcc dot gnu.org 2012-02-19 20:23 ` tkoenig at gcc dot gnu.org 2012-06-29 18:09 ` 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-47844-4-ee8sAbBhCB@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).