diff mbox

gfortran.dg/pr32627.f03 prints nul byte

Message ID 5526CAF9.8080907@redhat.com
State New
Headers show

Commit Message

Martin Sebor April 9, 2015, 6:54 p.m. UTC
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
diff mbox

Patch

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