2 ! { dg-options "-Wrealloc-lhs-all -Wrealloc-lhs" }
10 integer, allocatable :: a(:), b
11 real, allocatable :: r(:)
12 type(t), allocatable :: c(:)
13 character(len=:), allocatable :: str
14 character(len=:), allocatable :: astr(:)
16 allocate(a(2), b, c(1))
17 b = 4 ! { dg-warning "Code for reallocating the allocatable variable" }
18 a = [b,b] ! { dg-warning "Code for reallocating the allocatable array" }
19 c = [t(4)] ! { dg-warning "Code for reallocating the allocatable variable" }
22 str = 'abc' ! { dg-warning "Code for reallocating the allocatable variable" }
23 astr = 'abc' ! no realloc
24 astr = ['abc'] ! { dg-warning "Code for reallocating the allocatable array" }
25 a = reshape(a,shape(a)) ! { dg-warning "Code for reallocating the allocatable array" }
26 r = sin(r) ! { dg-warning "Code for reallocating the allocatable array" }
27 r = sin(r(1)) ! no realloc
28 b = sin(r(1)) ! { dg-warning "Code for reallocating the allocatable variable" }
30 a = nar() ! { dg-warning "Code for reallocating the allocatable array" }
31 a = nar2() ! { dg-warning "Code for reallocating the allocatable array" }
34 integer,allocatable :: nar(:)