This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PR26661 Testcase


I plan to commit the attached two files to testsuite/gfortran.dg sometime tomorrow. One file contains a simple c function to create the test file needed. The test case calls this function, does the test, and deletes it when its done.

Tested with make -k check-fortran.

Regards,

Jerry

! { dg-do run }
! { dg-additional-sources read_x_past.c }
! PR 26661 : Test reading X's past file end with no LF or CR
! Contributed by Jerry DeLisle <jvdelisle@gcc.gnu.org>.
      implicit none
      character(3) a(4)
      integer i
      call write_test_file
      open(unit=5, file="read_x_past.dat")
      read(unit=5,fmt=10)(a(i),i=1,4)
      if (a(4).ne."jkl") call abort()
 10   format(1x,a3,1x,a3,1x,a3,1x,a3,10x)
      close(unit=5, status="delete")
      end
/* This function is called by read_x_past.f to create
   a short test file that has no CR or LF at the end.
   Needed to test for pr26661.
   Submitted by Jerry DeLisle  <jvdelisle@gcc.gnu.org> */
#include <stdio.h>
void write_test_file_ (void)
{
  FILE *fp;
  fp = fopen("read_x_past.dat", "w");
  fputs(" abc def ghi jkl", fp);
  fclose(fp);
}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]