From: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
To: gcc-patches@gcc.gnu.org, fortran@gcc.gnu.org
Cc: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>,
Bernhard Reutner-Fischer <aldot@gcc.gnu.org>,
Jakub Jelinek <jakub@redhat.com>
Subject: [PATCH,Fortran 2/2] Fix write_omp_udr for user-operator REDUCTIONs
Date: Fri, 29 Oct 2021 01:52:59 +0200 [thread overview]
Message-ID: <20211028235259.1411169-2-rep.dot.nop@gmail.com> (raw)
In-Reply-To: <20211028235259.1411169-1-rep.dot.nop@gmail.com>
From: Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
Due to a typo a user operator used in a reduction was not found in the
symtree so would have been written multiple times (in theory).
E.g. user operator ".add." was looked up as ".ad" instead of "add".
For gcc-11 branch and earlier one would
- memcpy (name, udr->name, len - 1);
+ memcpy (name, udr->name + 1, len - 1);
but for gcc-12 we have an appropriate helper already.
Jakub, please take care of non-trunk branches if you want it fixed
there.
Cc: Jakub Jelinek <jakub@redhat.com>
gcc/fortran/ChangeLog:
2017-11-16 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
* module.c (write_omp_udr): Use gfc_get_name_from_uop.
---
gcc/fortran/module.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c
index 1328414e4f7..90ab9e275f3 100644
--- a/gcc/fortran/module.c
+++ b/gcc/fortran/module.c
@@ -6021,12 +6021,8 @@ write_omp_udr (gfc_omp_udr *udr)
return;
else
{
- gfc_symtree *st;
- size_t len = strlen (udr->name + 1);
- char *name = XALLOCAVEC (char, len);
- memcpy (name, udr->name, len - 1);
- name[len - 1] = '\0';
- st = gfc_find_symtree (gfc_current_ns->uop_root, name);
+ const char *name = gfc_get_name_from_uop (udr->name);
+ gfc_symtree *st = gfc_find_symtree (gfc_current_ns->uop_root, name);
/* If corresponding user operator is private, don't write
the UDR. */
if (st != NULL)
--
2.33.0
next prev parent reply other threads:[~2021-10-28 23:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-28 23:52 [PATCH,Fortran 1/2] Add uop/name helpers Bernhard Reutner-Fischer
2021-10-28 23:52 ` Bernhard Reutner-Fischer [this message]
2021-10-29 11:13 ` Jakub Jelinek
2021-10-29 17:15 ` Bernhard Reutner-Fischer
2021-10-29 21:28 ` Bernhard Reutner-Fischer
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=20211028235259.1411169-2-rep.dot.nop@gmail.com \
--to=rep.dot.nop@gmail.com \
--cc=aldot@gcc.gnu.org \
--cc=fortran@gcc.gnu.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
/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: link
Be 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).