Debian Codegraph @

gcc/testsuite/gcc.target/powerpc/ppc-fortran/pr80108-1.f90

raw
1 ! Originally contributed by Tobias Burnas.
2 ! { dg-do compile { target { powerpc*-*-* } } }
3 ! { dg-require-effective-target powerpc_vsx }
4 ! { dg-options "-mdejagnu-cpu=405 -mpower9-minmax" }
5 ! { dg-excess-errors "expect error due to conflicting target options" }
6 ! Since the error message is not associated with a particular line
7 ! number, we cannot use the dg-error directive and cannot specify a
8 ! regexp to describe the expected error message. The expected error
9 ! message is:
10 ! "Power9 target option is incompatible with -mcpu=<xxx> for <xxx>
11 ! less than power9"
12
13 program stream_test
14 implicit none
15 character(len=*), parameter :: rec1 = 'record1'
16 character(len=*), parameter :: rec2 = 'record2'
17 character(len=50) :: str1,str2
18 integer :: len, i
19 real :: r
20
21 open(10,form='formatted',access='stream',&
22 status='scratch',position='rewind')
23 write(10,'(a)') rec1//new_line('a')//rec2
24 rewind(10)
25 read(10,*) str1
26 read(10,*) str2
27 if(str1 /= rec1 .or. str2 /= rec2) STOP 1
28 rewind(10)
29 read(10,'(a)') str1
30 read(10,'(a)') str2
31 if(str1 /= rec1 .or. str2 /= rec2) STOP 2
32 close(10)
33
34 open(10,form='formatted',access='stream',&
35 status='scratch',position='rewind')
36 write(10,*) '123 '//trim(rec1)//' 1e-12'
37 write(10,*) '12345.6789'
38 rewind(10)
39 read(10,*) i,str1
40 read(10,*) r
41 if(i /= 123 .or. str1 /= rec1 .or. r /= 12345.6789) &
42 STOP 3
43 close(10)
44
45 open(unit=10,form='unformatted',access='stream', &
46 status='scratch',position='rewind')
47 write(10) rec1//new_line('a')//rec2
48 len = len_trim(rec1//new_line('a')//rec2)
49 rewind(10)
50 read(10) str1(1:len)
51 if(str1 /= rec1//new_line('a')//rec2) STOP 4
52 end program stream_test