From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 101694 invoked by alias); 5 Sep 2018 15:02:45 -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 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== 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 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, 05 Sep 2018 15:02:00 -0000 Message-Id: <20180905145732.404-19-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/msg00046.txt.bz2 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; -- 2.19.0.rc1