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/108838] New: [OpenMP] Array section of allocatable deferred-string has the wrong offset for the data component Date: Fri, 17 Feb 2023 17:04:51 +0000 [thread overview] Message-ID: <bug-108838-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108838 Bug ID: 108838 Summary: [OpenMP] Array section of allocatable deferred-string has the wrong offset for the data component Product: gcc Version: 13.0 Status: UNCONFIRMED Keywords: openmp, wrong-code Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: burnus at gcc dot gnu.org Target Milestone: --- The following program fails. Looking at the address passed to GOMP_target_enter_exit_data, it has the address of 'astr(3)' not of 'astr(4)' as expected. (Looks vaguely related to issue PR 108837, but internally different.) The dump shows: parm.8.data = (void *) &(*(character(kind=1)[0:][1:.astr] * restrict) astr.data)[4 - astr.dim[0].lbound]; which is identical to: parm.8.data = (void *) &(*(character(kind=1)[0:][1:.astr] * restrict) astr.data)[1]; and it sees as if '1:.astr' effectively is 0 as that would explain the offset of 0. Probably, we want to use the array syntax only if the UNIT_SIZE is either a constant or a SAVE_EXPR but not if it is some other expression. Or in other words: We probably do not want to use the array syntax for deferred strings. I wonder whether it will work with CLASS which has the same issue (int the case the dynamic type has more components as the declared one). * * * character(len=:), allocatable :: astr(:) allocate(character(len=6) :: astr(3:5)) print '(z16,a)', loc(astr), ' astr' print '(z16,a)', loc(astr(4)), ' astr4' !$omp target enter data map(alloc: astr(4:5)) astr(3) = "01db45" !$omp target map(alloc: astr(4:5)) if (.not. allocated(astr)) error stop if (len(astr) /= 6) error stop if (size(astr) /= 3) error stop if (lbound(astr, 1) /= 3) error stop if (ubound(astr, 1) /= 5) error stop astr(4:5) = ["jk$D%S", "zutg47"] !$omp end target !$omp target exit data map(from: astr(4:5)) if (.not. allocated(astr)) error stop if (len(astr) /= 6) error stop if (size(astr) /= 3) error stop if (lbound(astr, 1) /= 3) error stop if (ubound(astr, 1) /= 5) error stop print '(">",a,"<")', astr if (any (astr /= ["01db45", "jk$D%S", "zutg47"])) error stop end
reply other threads:[~2023-02-17 17:04 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-108838-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).