From patchwork Sat Jan 6 19:10:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janne Blomqvist X-Patchwork-Id: 856446 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-470304-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="hL8qxP1B"; 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 3zDWMc64P9z9s7F for ; Sun, 7 Jan 2018 06:10:35 +1100 (AEDT) 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; q=dns; s=default; b=OQ+Y4lpaait6 VzsfHcaU2utxeKLFgvzM8FJWhTTJ38LgitokTP0k3cubMVHRi5l1kp2S1GCU/Tfz jAMw8+QTp+QIYDDDQKiiN2hhbFqCu8RrUxvsV7WaM83yzQDDsTdk8I1GleMqrrDk 2iiVpqDRiN6ThCqO7VtK3tG40N9jaj8= 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; s=default; bh=wOzLQTUDVCQdX7XVNG F2AG1WohI=; b=hL8qxP1Bn4oqEYLAlEpYnvt8wmoN3QWdnXg0adKme7bGY5BPFM pWqOYJu9e1t9D3S0TxD4PaDSnqzXBIMHO/T0ydy2v+/462M1ND7/8gA9j8ahwZnD drB+mXu+yJRrmxDHSXzeZICMWvZ8IY9A6Epf+/sV7cL5ta2hv5t5KlhGA= Received: (qmail 49972 invoked by alias); 6 Jan 2018 19:10:27 -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 49946 invoked by uid 89); 6 Jan 2018 19:10:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 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= X-Spam-User: qpsmtpd, 2 recipients X-HELO: mail-lf0-f66.google.com Received: from mail-lf0-f66.google.com (HELO mail-lf0-f66.google.com) (209.85.215.66) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 06 Jan 2018 19:10:24 +0000 Received: by mail-lf0-f66.google.com with SMTP id j143so8319812lfg.0; Sat, 06 Jan 2018 11:10:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=2KI+5oh4RfzzgTABNkhnGp+CasH7QR0XfyTxiOkAeFE=; b=KuKbVOlKrtXzYmwtGTJYRRSuylu47KSfF9gXMaEB50BOswMBFEPmN1ObZYkX/Brmw+ MPzWQBTP8NSA++Pl7IAw6S//MT1l3PAa6K1etfMqnEgzaIz55ZQM7nDdkZeINqtExMwb SyEoPsirtW9JAc/fFmm8LgiOA6goYBOCNH1IKkSNS0uuk9ln8Cr/o7YhB5sUbvBpNmC3 ujWEsO2f91TgTK3PHqCzDSl4Vbm6CGk++xaEgmsvt+L3M3JbZBWjymSeQtrAlv9qHrhQ DPgu6GFVHdiEXg0XM4C5i+QfnHTim2hhfL+qgiaK/ExSBugmW0EgYHpnKIwuj7zKVH3c zZ7g== X-Gm-Message-State: AKGB3mLyMHPgOGwys+SNfbT1Q3D2c4yq6WEpq0Ry5qG7uEvMHrthMlVz OI+UqucTFigC+mWoP2jMvqYozA== X-Google-Smtp-Source: ACJfBou4O9XeP0w02mmPLq82HW7dNifxiyY+66gWXKcEZsEcjK9JcPP+Bq0QZ8KnualB9m0QQ1HDHw== X-Received: by 10.46.13.18 with SMTP id 18mr3788041ljn.98.1515265821325; Sat, 06 Jan 2018 11:10:21 -0800 (PST) Received: from dt.lan (a88-114-247-254.elisa-laajakaista.fi. [88.114.247.254]) by smtp.gmail.com with ESMTPSA id i67sm1534682lfk.6.2018.01.06.11.10.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 06 Jan 2018 11:10:20 -0800 (PST) From: Janne Blomqvist To: fortran@gcc.gnu.org, gcc-patches@gcc.gnu.org Cc: Janne Blomqvist Subject: [PATCH] PR 83704 Use size_t in write_character Date: Sat, 6 Jan 2018 21:10:13 +0200 Message-Id: <1515265813-30639-1-git-send-email-blomqvist.janne@gmail.com> For printing long characters, we need to use size_t instead of int in the argument to write_character. Regtested on x86_64-pc-linux-gnu, approved in the PR, committed to trunk. libgfortran/ChangeLog: 2018-01-06 Dominique d'Humieres Janne Blomqvist PR fortran/83704 * io/write.c (write_character): Use size_t instead of int for length. --- libgfortran/io/write.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libgfortran/io/write.c b/libgfortran/io/write.c index 3aa2f0e..6e3cc10 100644 --- a/libgfortran/io/write.c +++ b/libgfortran/io/write.c @@ -1359,9 +1359,9 @@ write_integer (st_parameter_dt *dtp, const char *source, int kind) #define NODELIM 0 static void -write_character (st_parameter_dt *dtp, const char *source, int kind, int length, int mode) +write_character (st_parameter_dt *dtp, const char *source, int kind, size_t length, int mode) { - int i, extra; + size_t extra; char *p, d; if (mode == DELIM) @@ -1390,7 +1390,7 @@ write_character (st_parameter_dt *dtp, const char *source, int kind, int length, { extra = 2; - for (i = 0; i < length; i++) + for (size_t i = 0; i < length; i++) if (source[i] == d) extra++; } @@ -1410,7 +1410,7 @@ write_character (st_parameter_dt *dtp, const char *source, int kind, int length, { *p4++ = d4; - for (i = 0; i < length; i++) + for (size_t i = 0; i < length; i++) { *p4++ = (gfc_char4_t) source[i]; if (source[i] == d) @@ -1428,7 +1428,7 @@ write_character (st_parameter_dt *dtp, const char *source, int kind, int length, { *p++ = d; - for (i = 0; i < length; i++) + for (size_t i = 0; i < length; i++) { *p++ = source[i]; if (source[i] == d)