From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 69276 invoked by alias); 5 Sep 2018 14:58:00 -0000 Mailing-List: contact fortran-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: fortran-owner@gcc.gnu.org Received: (qmail 68569 invoked by uid 89); 5 Sep 2018 14:57:55 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.7 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1459 X-HELO: mail-wm0-f47.google.com Received: from mail-wm0-f47.google.com (HELO mail-wm0-f47.google.com) (74.125.82.47) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 05 Sep 2018 14:57:53 +0000 Received: by mail-wm0-f47.google.com with SMTP id n11-v6so8057993wmc.2; Wed, 05 Sep 2018 07:57:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Q9rtq/sc/pgIp5eXCTv2YkdzqGruCT8VDLBbmhOmzGY=; b=oLROz4VGwPTf7kcc4Tfgq+57Wew3bZ+dj4i+ekyjhmHdhrMkSDJuaIQgmv+X6FeEEX OgkmhsG92HErAjqmAloUboigv/3Nxn4oD3rsIQ1VDtUSzRwweHBWGR8w1e3Bg0QL0sHg javIuawCq1oudV1zHddPIizJOxYJMQobjjjWyqgAljRCnBrByFYTNcvqeXjQY99y0Pd7 5YwAssspEop0NFmVCqkb9xnFEOVWJmtzJ+IZ0lKw+H9y7w/yXS1B0TUW9N+Xh3uvKjMr X+qu7HF6dymm6OMmqQMc/ICHOL4JUuiVRwuCExUNr9AID33ndlntJzJ7AkgZhLiBcfb7 6oWQ== Return-Path: Received: from s46.loc (91-119-125-11.dsl.dynamic.surfer.at. [91.119.125.11]) by smtp.gmail.com with ESMTPSA id b189-v6sm3037387wmd.39.2018.09.05.07.57.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Sep 2018 07:57:49 -0700 (PDT) Received: from cow by s46.loc with local (Exim 4.91) (envelope-from ) id 1fxZFZ-00007u-ME; Wed, 05 Sep 2018 14:57:45 +0000 From: Bernhard Reutner-Fischer To: fortran@gcc.gnu.org Cc: Bernhard Reutner-Fischer , gcc-patches@gcc.gnu.org, Jakub Jelinek Subject: [PATCH,FORTRAN 14/29] Fix write_omp_udr for user-operator REDUCTIONs Date: Wed, 05 Sep 2018 14:58:00 -0000 Message-Id: <20180905145732.404-15-rep.dot.nop@gmail.com> In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2018-09/txt/msg00032.txt.bz2 From: Bernhard Reutner-Fischer 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-8 branch and earlier one would - memcpy (name, udr->name, len - 1); + memcpy (name, udr->name + 1, len - 1); but for gcc-9 we have an appropriate helper already. Jakub, please take care of non-trunk branches if you want it fixed there. gcc/fortran/ChangeLog: 2017-11-16 Bernhard Reutner-Fischer * 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 fe5ae34dd13..b94411ac68b 100644 --- a/gcc/fortran/module.c +++ b/gcc/fortran/module.c @@ -5685,12 +5685,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.19.0.rc1