PR26661 Testcase

Bud Davis bdavis9659@sbcglobal.net
Sun Mar 26 13:01:00 GMT 2006


in the interest of fully using the more esoteric
features of the fortran langauge, how about the
following to create the file:

[bdavis@gfortran bin]$ cat a.f
  100    format(A,$)
         write(7,100)' abc def ghi jkl'
         end
[bdavis@gfortran bin]$ gfc a.f
[bdavis@gfortran bin]$ ./a.out
[bdavis@gfortran bin]$ hexdump fort.7
0000000 6120 6362 6420 6665 6720 6968 6a20 6c6b
0000010

which is the same as:

[bdavis@gfortran bin]$ hexdump read_x_past.dat
0000000 6120 6362 6420 6665 6720 6968 6a20 6c6b
0000010


regards,
bud davis


--- Jerry DeLisle <jvdelisle@verizon.net> wrote:

> 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);
> }
> 



More information about the Fortran mailing list