public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Martin Sebor <msebor@redhat.com>
To: Gcc Patch List <gcc-patches@gcc.gnu.org>
Subject: [PATCH] gfortran.dg/pr32627.f03 prints nul byte
Date: Thu, 09 Apr 2015 18:54:00 -0000	[thread overview]
Message-ID: <5526CAF9.8080907@redhat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 641 bytes --]

We've been debugging a problem where nul (and other control)
characters have been randomly appearing in powerpc parallel
build logs. In the process, I noticed that some of the nuls
are readily reproducible. One such case is due to
the pr32627.f03 test which verifies that Fortran programs
can initialize character arrays from C strings. The test
declares an array as big as the C string (including the
terminating nul) and prints its value to stdout. This then
causes the nul to appear in the log files.

The attached patch changes the declaration of the Fortran
array to match the number of non-nul characters. Tested on
powerpc64.

Martin

[-- Attachment #2: gcc-pr32627.f03-nul.patch --]
[-- Type: text/x-patch, Size: 607 bytes --]

2015-04-09  Martin Sebor  <msebor@redhat.com>

	* gfortran.dg/pr32627.f03 (strptr): Change size to match the number
	of non-nul characters.

diff --git a/gcc/testsuite/gfortran.dg/pr32627.f03 b/gcc/testsuite/gfortran.dg/pr32627.f03
index f8695e0..d9e2b13 100644
--- a/gcc/testsuite/gfortran.dg/pr32627.f03
+++ b/gcc/testsuite/gfortran.dg/pr32627.f03
@@ -18,7 +18,7 @@ program main
   type( c_ptr )               :: x
   type( A ), pointer          :: fptr
   type( A ), target           :: my_a_type
-  character( len=9 ), pointer :: strptr
+  character( len=8 ), pointer :: strptr
 
   fptr => my_a_type
 

             reply	other threads:[~2015-04-09 18:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-09 18:54 Martin Sebor [this message]
2015-04-09 21:16 ` Martin Sebor
2015-04-17 17:51   ` msebor
2015-04-17 19:29     ` Jeff Law

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5526CAF9.8080907@redhat.com \
    --to=msebor@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).