aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerry DeLisle <jvdelisle@gcc.gnu.org>2024-01-07 10:22:19 -0800
committerJerry DeLisle <jvdelisle@gcc.gnu.org>2024-01-07 10:32:04 -0800
commitadd995ec117d756e61d207041cd32f937c1a1cd9 (patch)
tree15db8e8bef21cfac0376a11e3c1b45bc24ce346e
parent0a8aba760f62e9d66cc5610ecc276c1f0befc651 (diff)
downloadgcc-add995ec117d756e61d207041cd32f937c1a1cd9.zip
gcc-add995ec117d756e61d207041cd32f937c1a1cd9.tar.gz
gcc-add995ec117d756e61d207041cd32f937c1a1cd9.tar.bz2
libgfortran: Emit a space at beginning of internal unit NML.
PR libgfortran/113223 libgfortran/ChangeLog: * io/write.c (namelist_write): If internal_unit precede with space. gcc/testsuite/ChangeLog: * gfortran.dg/dtio_25.f90: Update. * gfortran.dg/namelist_57.f90: Update. * gfortran.dg/namelist_65.f90: Update.
-rw-r--r--gcc/testsuite/gfortran.dg/dtio_25.f902
-rw-r--r--gcc/testsuite/gfortran.dg/namelist_57.f902
-rw-r--r--gcc/testsuite/gfortran.dg/namelist_65.f902
-rw-r--r--libgfortran/io/write.c2
4 files changed, 5 insertions, 3 deletions
diff --git a/gcc/testsuite/gfortran.dg/dtio_25.f90 b/gcc/testsuite/gfortran.dg/dtio_25.f90
index 8ca0848..1de7dc0 100644
--- a/gcc/testsuite/gfortran.dg/dtio_25.f90
+++ b/gcc/testsuite/gfortran.dg/dtio_25.f90
@@ -50,7 +50,7 @@ program p
namelist /nml/ x
x = t('a', 5)
write (buffer, nml)
- if (buffer.ne.'&NML X=a, 5 /') STOP 1
+ if (buffer.ne.' &NML X=a, 5 /') STOP 1
x = t('x', 0)
read (buffer, nml)
if (x%c.ne.'a'.or. x%k.ne.5) STOP 2
diff --git a/gcc/testsuite/gfortran.dg/namelist_57.f90 b/gcc/testsuite/gfortran.dg/namelist_57.f90
index a72b866..8f4c4ed 100644
--- a/gcc/testsuite/gfortran.dg/namelist_57.f90
+++ b/gcc/testsuite/gfortran.dg/namelist_57.f90
@@ -6,7 +6,7 @@
n = 123
line = ""
write(line,nml=stuff)
- if (line(1) .ne. "&STUFF") STOP 1
+ if (line(1) .ne. " &STUFF") STOP 1
if (line(2) .ne. " N=123 ,") STOP 2
if (line(3) .ne. " /") STOP 3
end
diff --git a/gcc/testsuite/gfortran.dg/namelist_65.f90 b/gcc/testsuite/gfortran.dg/namelist_65.f90
index 2ca67f2..424c722 100644
--- a/gcc/testsuite/gfortran.dg/namelist_65.f90
+++ b/gcc/testsuite/gfortran.dg/namelist_65.f90
@@ -13,7 +13,7 @@ do i=1,len(out)
enddo
write(out,nl1)
-if (out(1).ne."&NL1") STOP 1
+if (out(1).ne." &NL1") STOP 1
if (out(2).ne." A= 1.00000000 ,") STOP 2
if (out(3).ne." B= 2.00000000 ,") STOP 3
if (out(4).ne." C= 3.00000000 ,") STOP 4
diff --git a/libgfortran/io/write.c b/libgfortran/io/write.c
index a0401fe..49beaee 100644
--- a/libgfortran/io/write.c
+++ b/libgfortran/io/write.c
@@ -2466,6 +2466,8 @@ namelist_write (st_parameter_dt *dtp)
dtp->u.p.nml_delim = '\0';
}
+ if (is_internal_unit (dtp))
+ write_character (dtp, " ", 1, 1, NODELIM);
write_character (dtp, "&", 1, 1, NODELIM);
/* Write namelist name in upper case - f95 std. */