From patchwork Wed Sep 5 14:57:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Reutner-Fischer X-Patchwork-Id: 966436 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-485231-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="ovq00N1l"; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="dTnHvYYQ"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4256Pl1Hp0z9s5c for ; Thu, 6 Sep 2018 01:02:34 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; q=dns; s=default; b=gSq V/Wm0UgBCYBsXMV98nj5iNNPmTHlQtaKj+tfIyR2Yfxw4r/wT3S4vrbq2tvm2KQ3 b7fldICVSG5mKdKydRi4Jh6A9enu/p+odD4EC5ZgjSSF2Cnhsq64j1tD+sPHodzX jFUqRlO1x5Z0Vv783ObDvykz7/qXyDkrpNd6HAEY= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=default; bh=wKeuKm61I Tl8bzifjqih+HNVYyU=; b=ovq00N1lptnqce+doYOipocHgt1PKpDmq2GlqNeyW 27IcHXdexSAqquGEREQ1byKOsIqarWszYH8Hx9ihIVxh/7MC58NUymsIhNPStDeQ f7JTpedu2GMUPqvt5lV1c7MahMejMBSvDGeUccvZnJxYzYywlIY9c4rpCWDmiu8R 7w= Received: (qmail 69608 invoked by alias); 5 Sep 2018 14:58:02 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 68507 invoked by uid 89); 5 Sep 2018 14:57:54 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.6 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=HContent-Transfer-Encoding:8bit X-HELO: mail-wm0-f45.google.com Received: from mail-wm0-f45.google.com (HELO mail-wm0-f45.google.com) (74.125.82.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 05 Sep 2018 14:57:53 +0000 Received: by mail-wm0-f45.google.com with SMTP id y2-v6so8334595wma.1; Wed, 05 Sep 2018 07:57:52 -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=oxnzTP1aClWew8MasCgnafxAv9zZXfht0sPQuoC9bvg=; b=dTnHvYYQgzM+dELprqxs6TuyCSgCvRh28y1tlQZ5z9cZTR6R/weekxPZWZ6A3Imn4p J3k5EUaPWVKnfY+/l2PRrVk/idZ0qqKqFcGygSbuoy8yiPPv+uruFUIIBQRSZiJRkoj0 tEZLXYHfV3RD5M1NYZMn43cYgCNr6oS9n9Cemcxo5Yc61YsA23pr6qeZc3liAemQgfgK LD/oQF/5Td5HZp8S3jMJcSJMqBVVWFKU+ruYVmNk/bkQ/PLdmewpplvG3mEmGbeK9ukX hCb4GN6uShi5jvKmxj6JeZoEykGM2wWk2aGwLb3UFyrNSvMarx8BaKEIvsF2ephiliq1 H54g== Received: from s46.loc (91-119-125-11.dsl.dynamic.surfer.at. [91.119.125.11]) by smtp.gmail.com with ESMTPSA id g126-v6sm2505331wmg.5.2018.09.05.07.57.46 (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 1fxZFY-00007i-TK; 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 Subject: [PATCH,FORTRAN 10/29] Do not copy name for check_function_name Date: Wed, 5 Sep 2018 14:57:13 +0000 Message-Id: <20180905145732.404-11-rep.dot.nop@gmail.com> In-Reply-To: References: MIME-Version: 1.0 X-IsSubscribed: yes From: Bernhard Reutner-Fischer Copying the sym->name ruins pointer equality checks and first and foremost is not needed nowadays. gcc/fortran/ChangeLog: 2018-09-02 Bernhard Reutner-Fischer * decl.c (gfc_match_volatile, gfc_match_asynchronous): Do not copy sym->name. --- gcc/fortran/decl.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index 2667c2281f8..b0c45b88505 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -9167,7 +9167,6 @@ match gfc_match_volatile (void) { gfc_symbol *sym; - char *name; match m; if (!gfc_notify_std (GFC_STD_F2003, "VOLATILE statement at %C")) @@ -9189,9 +9188,7 @@ gfc_match_volatile (void) switch (m) { case MATCH_YES: - name = XCNEWVAR (char, strlen (sym->name) + 1); - strcpy (name, sym->name); - if (!check_function_name (name)) + if (!check_function_name (sym->name)) return MATCH_ERROR; /* F2008, C560+C561. VOLATILE for host-/use-associated variable or for variable in a BLOCK which is defined outside of the BLOCK. */ @@ -9231,7 +9228,6 @@ match gfc_match_asynchronous (void) { gfc_symbol *sym; - char *name; match m; if (!gfc_notify_std (GFC_STD_F2003, "ASYNCHRONOUS statement at %C")) @@ -9253,9 +9249,7 @@ gfc_match_asynchronous (void) switch (m) { case MATCH_YES: - name = XCNEWVAR (char, strlen (sym->name) + 1); - strcpy (name, sym->name); - if (!check_function_name (name)) + if (!check_function_name (sym->name)) return MATCH_ERROR; if (!gfc_add_asynchronous (&sym->attr, sym->name, &gfc_current_locus)) return MATCH_ERROR;