From patchwork Wed Sep 22 03:31:48 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerry DeLisle X-Patchwork-Id: 65395 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id AE083B70DC for ; Wed, 22 Sep 2010 13:32:13 +1000 (EST) Received: (qmail 1980 invoked by alias); 22 Sep 2010 03:32:11 -0000 Received: (qmail 1962 invoked by uid 22791); 22 Sep 2010 03:32:10 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from out02.roch.ny.frontiernet.net (HELO out02.roch.ny.frontiernet.net) (66.133.183.227) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 22 Sep 2010 03:32:05 +0000 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvsEAAcWmUxA6lwO/2dsb2JhbACiK8Y9hUEEhE4 Received: from relay02.roch.ny.frontiernet.net ([66.133.182.165]) by out02.roch.ny.frontiernet.net with ESMTP; 22 Sep 2010 03:31:50 +0000 X-Previous-IP: 64.234.92.14 Received: from quava.localdomain (host-64-234-92-14.nctv.com [64.234.92.14]) by relay02.roch.ny.frontiernet.net (Postfix) with ESMTPA id 90CEE10FA96; Wed, 22 Sep 2010 03:31:49 +0000 (UTC) Message-ID: <4C9978A4.6010601@frontier.com> Date: Tue, 21 Sep 2010 20:31:48 -0700 From: Jerry DeLisle User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100907 Fedora/3.1.3-1.fc13 Thunderbird/3.1.3 MIME-Version: 1.0 To: gfortran CC: gcc patches Subject: [patch, libgfortran] PR45710 Adjust format and padding for WRITE of NAMELIST group to internal file 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 Hi, This patch pads the end of records with ' ' for internal character unit arrays. The patch is fairly obvious. Code borrowed from transfer.c. Regression tested ob x86-64. OK for trunk. I will also add a test case. Regards, Jerry 2010-09-21 Jerry DeLisle PR libfortran/45710 * io/write.c (namelist_write_newline): Pad character array internal unit records with spaces. Index: write.c =================================================================== --- write.c (revision 164472) +++ write.c (working copy) @@ -1630,7 +1630,21 @@ namelist_write_newline (st_parameter_dt *dtp) { gfc_offset record; int finished; + char *p; + int length = dtp->u.p.current_unit->bytes_left; + p = write_block (dtp, length); + if (p == NULL) + return; + + if (unlikely (is_char4_unit (dtp))) + { + gfc_char4_t *p4 = (gfc_char4_t *) p; + memset4 (p4, ' ', length); + } + else + memset (p, ' ', length); + /* Now that the current record has been padded out, determine where the next record in the array is. */ record = next_array_record (dtp, dtp->u.p.current_unit->ls,