Debian Codegraph @

gcc/testsuite/gfortran.dg/pr108889.f90

raw
1 ! { dg-do compile }
2 ! { dg-options "-Wall -fdump-tree-original" }
3 !
4 ! Contributed by Tobias Burnus <[email protected]>
5 !
6 program main
7 implicit none
8
9 type :: struct
10 real, allocatable :: var(:)
11 end type struct
12
13 type(struct) :: single
14 real, allocatable :: ref1(:), ref2(:), ref3(:), ref4(:)
15
16 ref2 = [1,2,3,4,5] ! Warnings here
17
18 single%var = ref2 ! No warnings for components
19 ref1 = single%var ! Warnings here
20 ref1 = [1,2,3,4,5] ! Should not add to tree dump count
21
22 allocate (ref3(5))
23 ref3 = single%var ! No warnings following allocation
24
25 call set_ref4
26
27 call test (ref1)
28 call test (ref2)
29 call test (ref3)
30 call test (ref4)
31
32 contains
33 subroutine test (arg)
34 real, allocatable :: arg(:)
35 if (size(arg) /= size(single%var)) stop 1
36 if (lbound(arg, 1) /= 1) stop 2
37 if (any (arg /= single%var)) stop 3
38 end
39 subroutine set_ref4
40 ref4 = single%var ! Warnings in contained scope
41 end
42 end
43 ! { df-final { scan-tree-dump-times "ubound = 0" 3 "original" } }