PR target/83368
[official-gcc.git] / gcc / testsuite / gfortran.dg / hollerith7.f90
blob8e2fb4fec12b92d705a1fd8bc886d1ad6ba33d6e
1 ! PR fortran/39865
2 ! { dg-do compile }
4 subroutine foo (a)
5 integer(kind=4), target :: a(1:, 1:)
6 integer(kind=4), pointer :: b(:, :)
7 b => a
8 write (*, fmt=a(1,2)) 1, 2, 3, 4, 5, 6, 7, 8
9 write (*, fmt=b(1,2)) 1, 2, 3, 4, 5, 6, 7, 8
10 end subroutine foo
11 subroutine bar (a, b)
12 character :: b(2,*)
13 integer :: a(*)
14 write (*, fmt=b) 1, 2, 3
15 write (*, fmt=a) 1, 2, 3
16 write (*, fmt=a(2)) 1, 2, 3
17 end subroutine
18 interface
19 subroutine foo (a)
20 integer(kind=4), target :: a(:, :)
21 end subroutine foo
22 end interface
23 integer(kind=4) :: a(2, 3)
24 a = 4HXXXX
25 a(2,2) = 4H (8I
26 a(1,3) = 2H4)
27 a(2,3) = 1H
28 call foo (a(2:2,:))
29 end
31 ! { dg-warning "Non-character in FORMAT tag" "FMT" { target *-*-* } 8 }
32 ! { dg-error "Non-character assumed shape array element in FORMAT tag" "element" { target *-*-* } 8 }
34 ! { dg-warning "Non-character in FORMAT tag" "FMT" { target *-*-* } 9 }
35 ! { dg-error "Non-character pointer array element in FORMAT tag" "element" { target *-*-* } 9 }
37 ! { dg-error "reference to the assumed size array" "assumed-size" { target *-*-* } 14 }
38 ! { dg-error "reference to the assumed size array" "assumed-size" { target *-*-* } 15 }
39 ! { dg-warning "Non-character in FORMAT tag" "FMT" { target *-*-* } 16 }
40 ! { dg-error "Non-character assumed size array element in FORMAT tag" "element" { target *-*-* } 16 }
42 ! { dg-warning "Hollerith constant" "const" { target *-*-* } 24 }
43 ! { dg-warning "Conversion" "conversion" { target *-*-* } 24 }
45 ! { dg-warning "Hollerith constant" "const" { target *-*-* } 25 }
46 ! { dg-warning "Conversion" "conversion" { target *-*-* } 25 }
48 ! { dg-warning "Hollerith constant" "const" { target *-*-* } 26 }
49 ! { dg-warning "Conversion" "conversion" { target *-*-* } 26 }
51 ! { dg-warning "Hollerith constant" "const" { target *-*-* } 27 }
52 ! { dg-warning "Conversion" "conversion" { target *-*-* } 27 }