From patchwork Wed Sep 5 14:57:21 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: 966446 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-485243-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="rBEnj5MD"; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="OfPYYTIy"; 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 4256TK2NZdz9sCw for ; Thu, 6 Sep 2018 01:05:41 +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=OaV q/w8flFxzupaj1LrRKWSQt9XAWlRuAd7gecC8j6oLtKVJNk4YFrv0cInStSO61E0 12lwdXykDP+TL9+wTB2rhe50/bPTWhnDWn2baADvsuKtVPLohNaeMo2F1wsDgnop RF3pdJfQ6khrxQH+nIjS6YNhXOmt9A7enGjGzuAY= 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=vqB5YveAr ILgChV/lHpH1pCDC/A=; b=rBEnj5MDtnehAP+ir9QXmoraGM4bSzwt0fWZ9Ys1J XMgAyqKttpz32omckXIba3u3Hig5jFoiebc6cp6b8RWL7kjzB/0PyGfYXx72uYtL 8bIEo7j9xF0E189nRb5O63SQxyYAYfoK4XRCRok2J0l3IDLJrUlOOcoMO3h2/uDO hE= Received: (qmail 101686 invoked by alias); 5 Sep 2018 15:02:45 -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 101548 invoked by uid 89); 5 Sep 2018 15:02:44 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.8 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-Received:a05 X-HELO: mail-wr1-f42.google.com Received: from mail-wr1-f42.google.com (HELO mail-wr1-f42.google.com) (209.85.221.42) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 05 Sep 2018 15:02:39 +0000 Received: by mail-wr1-f42.google.com with SMTP id g33-v6so8064720wrd.1; Wed, 05 Sep 2018 08:02:39 -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=JXQLvWaw+jEtZpo0cMkwDMk/JrCaTghuQc13gbU67DY=; b=OfPYYTIyD/b3G5VZS/xj0edYHULp42Mjd9AcFKAqbrcUmgXNf0M6xb1VgVsyjBGKiJ Ynca2APTgZU9V9upz6ArgPrRxbNW3ZR21qWgRK2BuCzSPx+7h2PSShskPzHgFC4qVD4z 47E1ySgS6EpJmQPl/TeyJi36XVeLc56hDbO5FwHTryUcKkcHxtVnRDtJ2BbpeJ5tNVyY qjmuxJiizaVInlpewqWpzX9oo733ZLTl3ojYp/dmhRk+RtvBqFjHLGHViAzf3dx44eXd T4HmrRUQ2w05E5FF5iAf2iT/1wFrFLwkttA/W2PTTDfNyvxQWGT59TIgW1tRl+dKSRdu gLOA== Received: from s46.loc (91-119-125-11.dsl.dynamic.surfer.at. [91.119.125.11]) by smtp.gmail.com with ESMTPSA id 139-v6sm4049468wmp.4.2018.09.05.08.02.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Sep 2018 08:02:36 -0700 (PDT) Received: from cow by s46.loc with local (Exim 4.91) (envelope-from ) id 1fxZFa-000086-7F; Wed, 05 Sep 2018 14:57:46 +0000 From: Bernhard Reutner-Fischer To: fortran@gcc.gnu.org Cc: Bernhard Reutner-Fischer , gcc-patches@gcc.gnu.org Subject: [PATCH,FORTRAN 18/29] Use stringpool for charkind Date: Wed, 5 Sep 2018 14:57:21 +0000 Message-Id: <20180905145732.404-19-rep.dot.nop@gmail.com> In-Reply-To: References: MIME-Version: 1.0 X-IsSubscribed: yes From: Bernhard Reutner-Fischer gcc/fortran/ChangeLog: 2017-11-24 Bernhard Reutner-Fischer * primary.c (match_charkind_name): Return stringpool node. (match_string_constant): Use stringpool node for name. --- gcc/fortran/primary.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c index da661372c5c..cd5f81542cb 100644 --- a/gcc/fortran/primary.c +++ b/gcc/fortran/primary.c @@ -950,8 +950,9 @@ next_string_char (gfc_char_t delimiter, int *ret) the name will be detected later. */ static match -match_charkind_name (char *name) +match_charkind_name (const char **result) { + char buffer [GFC_MAX_SYMBOL_LEN + 1]; locus old_loc; char c, peek; int len; @@ -961,8 +962,8 @@ match_charkind_name (char *name) if (!ISALPHA (c)) return MATCH_NO; - *name++ = c; - len = 1; + len = 0; + buffer[len++] = c; for (;;) { @@ -976,7 +977,8 @@ match_charkind_name (char *name) if (peek == '\'' || peek == '\"') { gfc_current_locus = old_loc; - *name = '\0'; + buffer[len] = '\0'; + *result = gfc_get_string ("%s", buffer); return MATCH_YES; } } @@ -986,8 +988,8 @@ match_charkind_name (char *name) && (c != '$' || !flag_dollar_ok)) break; - *name++ = c; - if (++len > GFC_MAX_SYMBOL_LEN) + buffer[len++] = c; + if (len > GFC_MAX_SYMBOL_LEN) break; } @@ -1005,9 +1007,10 @@ match_charkind_name (char *name) static match match_string_constant (gfc_expr **result) { - char name[GFC_MAX_SYMBOL_LEN + 1], peek; + char peek; + const char *name = NULL; size_t length; - int kind,save_warn_ampersand, ret; + int kind, save_warn_ampersand, ret; locus old_locus, start_locus; gfc_symbol *sym; gfc_expr *e; @@ -1043,7 +1046,7 @@ match_string_constant (gfc_expr **result) { gfc_current_locus = old_locus; - m = match_charkind_name (name); + m = match_charkind_name (&name); if (m != MATCH_YES) goto no_match;