OSDN Git Service

2010-02-06 Jerry DeLisle <jvdelisle@gcc.gnu.org>
authorjvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 7 Feb 2010 07:50:17 +0000 (07:50 +0000)
committerjvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 7 Feb 2010 07:50:17 +0000 (07:50 +0000)
PR libfortran/42742
* gfortran.dg/fmt_cache_2.f: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@156569 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/fmt_cache_2.f [new file with mode: 0644]

index 78d261d..d50b950 100644 (file)
@@ -1,5 +1,10 @@
 2010-02-06  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
 
+       PR libfortran/42742
+       * gfortran.dg/fmt_cache_2.f: New test.
+
+2010-02-06  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
+
        * gfortran.dg/read_no_eor.f90: New test.
 
 2010-02-05  Jason Merrill  <jason@redhat.com>
diff --git a/gcc/testsuite/gfortran.dg/fmt_cache_2.f b/gcc/testsuite/gfortran.dg/fmt_cache_2.f
new file mode 100644 (file)
index 0000000..f557a16
--- /dev/null
@@ -0,0 +1,36 @@
+! { dg-do run }
+! PR42742 Handle very large format strings correctly
+! Test derived from example developed by Manfred Schwarb.
+      character(12) bufarr(74)
+      character(74*13+30) fmtstr,fmtstr2
+      character(1) delim
+      integer i,j,dat(5),pindx, loopcounter
+      character(983) big_string ! any less and this test fails.
+
+      do i=1,74
+        write(bufarr(i),'(i12)') i
+      enddo
+
+      delim=" "
+      dat(1)=2009
+      dat(2)=10
+      dat(3)=31
+      dat(4)=3
+      dat(5)=0
+      fmtstr="(i2,i6,4(a1,i2.2)"
+      open(10, status="scratch")
+      do j=1,74
+        fmtstr=fmtstr(1:len_trim(fmtstr))//",a1,a12"
+        fmtstr2=fmtstr(1:len_trim(fmtstr))//")"
+c        write(0,*) "interation ",j,": ",len_trim(fmtstr2)
+        do i=1,10
+          write(10,fmtstr2)
+     &           i,dat(1),"-",dat(2),"-",dat(3),
+     &           delim,dat(4),":",dat(5),
+     &           (delim,bufarr(pindx),pindx=1,j)
+        enddo
+        loopcounter = j
+      enddo
+      close(10)
+      if (loopcounter /= 74) call abort
+      end