This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


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

fortran tests change


I propose to move the u77-test.f file from libf2c/U77 to the fortran
testsuite execute directory with these changes, so that the library
gets tested properly.  Craig will doubtless spot typos, testing
notwithstanding.

--- u77-test.f	Mon Jul 13 20:12:32 1998
+++ ../../gcc/testsuite/g77.f-torture/execute/u77-test.f	Sun Sep  6 13:54:35 1998
@@ -12,7 +12,7 @@
      +     stat, lstat, getcwd, gmtime, hostnm, etime, chmod,
      +     chdir, fgetc, fputc, system_clock, second, idate, secnds,
      +     time, ctime, fdate, ttynam, date_and_time
-      external lenstr
+      external lenstr, ctrlc
       integer lenstr
       logical l
       character gerr*80, c*1
@@ -21,6 +21,7 @@
       integer fstatb (13), statb (13)
       integer *2 i2zero
       integer values(8)
+      integer(kind=7) sigret
 
       ctim = ctime(time())
       WRITE (6,'(A/)') '1 GNU libU77 test at: ' // ctim
@@ -29,7 +30,7 @@
      +     // ' Unix i/o units ', fnum(5), fnum(6)
       if (lnblnk('foo ').ne.3 .or. len_trim('foo ').ne.3) then
         print *, 'LNBLNK or LEN_TRIM failed'
-        call exit(1)
+        call abort
       end if
       l= isatty(6)
       line2 = ttynam(6)
@@ -39,6 +40,9 @@
         line = 'and 6 isn''t a tty device (ISATTY)'
       end if
       write (6,'(1X,A)') line(:lenstr(line))
+      
+*     regression test for compiler crash fixed by JCB 1998-08-04 com.c
+      sigret = signal(2, ctrlc)
 
       pid = getpid()
       WRITE (6,'(A,I10)') ' Process id (GETPID): ', pid
@@ -76,21 +80,30 @@
 
 c consistency-check etime vs. dtime for first call
       r1 = etime (tarray1)
-      if (r1.ne.tarray1(1)+tarray1(2))
-     +     write (6,*) '*** ETIME didn''t return sum of the array: ',
-     +     r1, ' /= ', tarray1(1), '+', tarray1(2)
+      if (r1.ne.tarray1(1)+tarray1(2)) then
+        write (6,*) '*** ETIME didn''t return sum of the array: ',
+     +       r1, ' /= ', tarray1(1), '+', tarray1(2)
+        call abort
+      end if
       r2 = dtime (tarray2)
-      if (abs (r1-r2).gt.1.0) write (6,*)
-     +     'Results of ETIME and DTIME differ by more than a second:',
-     +     r1, r2
+      if (abs (r1-r2).gt.1.0) then
+        write (6,*)
+     +       'Results of ETIME and DTIME differ by more than a second:',
+     +       r1, r2
+      call abort
+      end if
       call sgladd (sum, tarray1(1), tarray1(2))
-      if (r1 .ne. sum)
-     +     write (6,*) '*** ETIME didn''t return sum of the array: ',
-     +     r1, ' /= ', tarray1(1), '+', tarray1(2)
+      if (r1 .ne. sum) then
+        write (6,*) '*** ETIME didn''t return sum of the array: ',
+     +       r1, ' /= ', tarray1(1), '+', tarray1(2)
+        call abort
+      end if
       call sgladd (sum, tarray2(1), tarray2(2))
-      if (r2 .ne. sum)
-     +     write (6,*) '*** DTIME didn''t return sum of the array: ',
-     +     r2, ' /= ', tarray2(1), '+', tarray2(2)
+      if (r2 .ne. sum) then
+        write (6,*) '*** DTIME didn''t return sum of the array: ',
+     +       r2, ' /= ', tarray2(1), '+', tarray2(2)
+        call abort
+      end if
       write (6, '(A,3F10.3)')
      +     ' Elapsed total, user, system time (ETIME): ',
      +     r1, tarray1
@@ -105,13 +118,17 @@
       end do
       r1 = etime (tarray1)
       call sgladd (sum, tarray1(1), tarray1(2))
-      if (r1 .ne. sum)
-     +     write (6,*) '*** ETIME didn''t return sum of the array: ',
-     +     r1, ' /= ', tarray1(1), '+', tarray1(2)
+      if (r1 .ne. sum) then
+        write (6,*) '*** ETIME didn''t return sum of the array: ',
+     +       r1, ' /= ', tarray1(1), '+', tarray1(2)
+        call abort
+      end if
       call sgladd (sum, tarray2(1), tarray2(2))
-      if (r2 .ne. sum)
-     +     write (6,*) '*** DTIME didn''t return sum of the array: ',
-     +     r2, ' /= ', tarray2(1), '+', tarray2(2)
+      if (r2 .ne. sum) then
+        write (6,*) '*** DTIME didn''t return sum of the array: ',
+     +       r2, ' /= ', tarray2(1), '+', tarray2(2)
+        call abort
+      end if
       write (6, '(A,3F10.3)')
      +     ' Differences in total, user, system time (DTIME): ',
      +     r2, tarray2
@@ -124,6 +141,10 @@
       call idate (idat)
       write (6,*) 'IDATE d,m,y: ',idat
       print *,  '... and the VXT version: ', i,j,k
+      if (i/=idat(2) .or. j/=idat(1) .or. k/=mod(idat(3),100)) then
+        print *, '*** vxy and u77 versions don''t agree'
+        call abort
+      end if
       call time(line(:8))
       print *, 'TIME: ', line(:8)
       write (6,*) 'SECNDS(0.0) returns: ',secnds(0.0)
@@ -134,14 +155,19 @@
       i = getcwd(wd)
       if (i.ne.0) then
         call perror ('*** getcwd')
+        call abort
       else
         write (6,*) 'Current directory is "'//wd(:lenstr(wd))//'"'
       end if
       call chdir ('.',i)
-      if (i.ne.0) write (6,*) '***CHDIR to ".": ', i
+      if (i.ne.0) then
+        write (6,*) '***CHDIR to ".": ', i
+        call abort
+      end if
       i=hostnm(wd)
       if(i.ne.0) then
         call perror ('*** hostnm')
+        call abort
       else
         write (6,*) 'Host name is ', wd(:lenstr(wd))
       end if
@@ -160,42 +186,75 @@
       call fseek(3,0,0,*10)
       go to 20
  10   write(6,*) '***FSEEK failed'
+      call abort
  20   call fgetc(3, c,i)
-      if (i.ne.0) write(6,*) '***FGETC: ', i
-      if (c.ne.'c') write(6,*) '***FGETC read the wrong thing: ',
-     +     ichar(c)
+      if (i.ne.0) then
+        write(6,*) '***FGETC: ', i
+        call abort
+      end if
+      if (c.ne.'c') then
+        write(6,*) '***FGETC read the wrong thing: ', ichar(c)
+        call abort
+      end if
       i= ftell(3)
-      if (i.ne.1) write(6,*) '***FTELL offset: ', i
+      if (i.ne.1) then
+        write(6,*) '***FTELL offset: ', i
+        call abort
+      end if
       call chmod ('foo', 'a+w',i)
-      if (i.ne.0) write (6,*) '***CHMOD of "foo": ', i
+      if (i.ne.0) then
+        write (6,*) '***CHMOD of "foo": ', i
+        call abort
+      end if
       i = fstat (3, fstatb)
-      if (i.ne.0) write (6,*) '***FSTAT of "foo": ', i
+      if (i.ne.0) then
+        write (6,*) '***FSTAT of "foo": ', i
+        call abort
+      end if
       i = stat ('foo', statb)
-      if (i.ne.0) write (6,*) '***STAT of "foo": ', i
+      if (i.ne.0) then
+        write (6,*) '***STAT of "foo": ', i
+        call abort
+      end if
       write (6,*) '  with stat array ', statb
       if (statb(5).ne.getuid () .or. statb(6).ne.getgid() .or. statb(4)
-     +     .ne. 1) write (6,*) '*** FSTAT uid, gid or nlink is wrong'
+     +     .ne. 1) then
+        write (6,*) '*** FSTAT uid, gid or nlink is wrong'
+        call abort
+      end if
       do i=1,13
-        if (fstatb (i) .ne. statb (i))
-     +       write (6,*) '*** FSTAT and STAT don''t agree on '// '
-     +       array element ', i, ' value ', fstatb (i), statb (i)
+        if (fstatb (i) .ne. statb (i)) then
+          write (6,*) '*** FSTAT and STAT don''t agree on '// '
+     +         array element ', i, ' value ', fstatb (i), statb (i)
+          call abort
+        end if
       end do
       i = lstat ('foo', fstatb)
       do i=1,13
-        if (fstatb (i) .ne. statb (i))
-     +       write (6,*) '*** LSTAT and STAT don''t agree on '// '
-     +       array element ', i, ' value ', fstatb (i), statb (i)
+        if (fstatb (i) .ne. statb (i)) then
+          write (6,*) '*** LSTAT and STAT don''t agree on '// '
+     +         array element ', i, ' value ', fstatb (i), statb (i)
+          call abort
+        end if
       end do
 
 C     in case it exists already:
       call unlink ('bar',i)
       call link ('foo ', 'bar ',i)
-      if (i.ne.0)
-     +     write (6,*) '***LINK "foo" to "bar" failed: ', i
+      if (i.ne.0) then
+        write (6,*) '***LINK "foo" to "bar" failed: ', i
+        call abort
+      end if
       call unlink ('foo',i)
-      if (i.ne.0) write (6,*) '***UNLINK "foo" failed: ', i
+      if (i.ne.0) then
+        write (6,*) '***UNLINK "foo" failed: ', i
+        call abort
+      end if
       call unlink ('foo',i)
-      if (i.eq.0) write (6,*) '***UNLINK "foo" again: ', i
+      if (i.eq.0) then
+        write (6,*) '***UNLINK "foo" again: ', i
+        call abort
+      end if
       call gerror (gerr)
       i = ierrno()
       write (6,'(A,I3,A/1X,A)') ' The current error number is: ',
@@ -205,8 +264,8 @@
       call getarg (0, line)
       call perror (line (:lenstr (line)))
       call unlink ('bar')
-      WRITE (6,*) 'You should see exit status 1'
-      CALL EXIT(1)
+C      WRITE (6,*) 'You should see exit status 1'
+      CALL EXIT(0)
  99   END
 
       integer function lenstr (str)
@@ -228,4 +287,10 @@
       implicit none
       real sum,left,right
       sum = left+right
+      end
+
+*     signal handler
+      subroutine ctrlc
+      print *, 'Got ^C'
+      call abort
       end


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