re PR fortran/36420 (Fortran 2008: g0 edit descriptor)
authorJerry DeLisle <jvdelisle@gcc.gnu.org>
Sun, 8 Jun 2008 00:09:01 +0000 (00:09 +0000)
committerJerry DeLisle <jvdelisle@gcc.gnu.org>
Sun, 8 Jun 2008 00:09:01 +0000 (00:09 +0000)
2008-06-07  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

PR fortran/36420
PR fortran/36421
PR fortran/36422
* gfortran.dg/fmt_g0_1.f08: New test.
* gfortran.dg/fmt_g0_2.f08: New test.
* gfortran.dg/fmt_g0_3.f08: New test.

From-SVN: r136547

gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/fmt_g0_1.f08 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/fmt_g0_2.f08 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/fmt_g0_3.f08 [new file with mode: 0644]

index a92d16e6f65776498bdedb9ce69fb17064b56f59..cc02b94f1d9fec25c8ef28ca60d78b2ec80e6675 100644 (file)
@@ -1,3 +1,12 @@
+2008-06-07  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
+
+       PR fortran/36420
+       PR fortran/36421
+       PR fortran/36422
+       * gfortran.dg/fmt_g0_1.f08: New test.
+       * gfortran.dg/fmt_g0_2.f08: New test.
+       * gfortran.dg/fmt_g0_3.f08: New test.
+
 2008-06-07  Xinliang David Li  <davidxl@google.com>
 
        PR/36440
diff --git a/gcc/testsuite/gfortran.dg/fmt_g0_1.f08 b/gcc/testsuite/gfortran.dg/fmt_g0_1.f08
new file mode 100644 (file)
index 0000000..c85ee2d
--- /dev/null
@@ -0,0 +1,20 @@
+! { dg-do run }
+! PR36420 Fortran 2008: g0 edit descriptor 
+! Test case provided by Jerry DeLisle <jvdelisle@gcc.gnu.org>
+    character(25) :: string = "(g0,g0,g0)" 
+    character(33) :: buffer
+    write(buffer, '(g0,g0,g0)') ':',12340,':'
+    if (buffer.ne.":12340:") call abort
+    write(buffer, string) ':',0,':'
+    if (buffer.ne.":0:") call abort
+    write(buffer, string) ':',1.0/3.0,':'
+    if (buffer.ne.": 0.33333334    :") call abort
+    write(buffer, '(1x,a,g0,a)') ':',1.0/3.0,':'
+    if (buffer.ne." : 0.33333334    :") call abort
+    write(buffer, string) ':',"hello",':'
+    if (buffer.ne.":hello:") call abort
+    write(buffer, "(g0,g0,g0,g0)") ':',.true.,.false.,':'
+    if (buffer.ne.":TF:") call abort
+    write(buffer, "(g0,g0,',',g0,g0)") '(',( 1.2345, 2.4567 ),')'
+    if (buffer.ne."(  1.2345001    ,  2.4567001    )") call abort
+end
diff --git a/gcc/testsuite/gfortran.dg/fmt_g0_2.f08 b/gcc/testsuite/gfortran.dg/fmt_g0_2.f08
new file mode 100644 (file)
index 0000000..c19e3f2
--- /dev/null
@@ -0,0 +1,11 @@
+! { dg-do run }
+! { dg-options "-std=f95 -pedantic" }
+! { dg-shouldfail "Zero width in format descriptor" }
+! PR36420 Fortran 2008: g0 edit descriptor 
+! Test case provided by Jerry DeLisle <jvdelisle@gcc.gnu.org>
+    character(25) :: string = "(g0,g0,g0)" 
+    character(33) :: buffer
+    write(buffer, string) ':',0,':'
+    if (buffer.ne.":0:") call abort
+end
+! { dg-output "Fortran runtime error: Zero width in format descriptor(\n|\r\n|\r)" }
diff --git a/gcc/testsuite/gfortran.dg/fmt_g0_3.f08 b/gcc/testsuite/gfortran.dg/fmt_g0_3.f08
new file mode 100644 (file)
index 0000000..a84b1f1
--- /dev/null
@@ -0,0 +1,7 @@
+! { dg-do compile }
+! { dg-options "-std=f95" }! PR36420 Fortran 2008: g0 edit descriptor 
+! Test case provided by Jerry DeLisle <jvdelisle@gcc.gnu.org>
+    character(25) :: string = "(g0,g0,g0)" 
+    character(33) :: buffer
+    write(buffer, '(g0,g0,g0)') ':',12340,':' ! { dg-error "Fortran F2008:" }
+end