1! { dg-do compile } 2! { dg-options "-Wrealloc-lhs-all -Wrealloc-lhs" } 3! 4! PR fortran/52196 5! 6implicit none 7type t 8 integer :: x 9end type t 10integer, allocatable :: a(:), b 11real, allocatable :: r(:) 12type(t), allocatable :: c(:) 13character(len=:), allocatable :: str 14character(len=:), allocatable :: astr(:) 15 16allocate(a(2), b, c(1)) 17b = 4 ! { dg-warning "Code for reallocating the allocatable variable" } 18a = [b,b] ! { dg-warning "Code for reallocating the allocatable array" } 19c = [t(4)] ! { dg-warning "Code for reallocating the allocatable variable" } 20a = 5 ! no realloc 21c = t(5) ! no realloc 22str = 'abc' ! { dg-warning "Code for reallocating the allocatable variable" } 23astr = 'abc' ! no realloc 24astr = ['abc'] ! { dg-warning "Code for reallocating the allocatable array" } 25a = reshape(a,shape(a)) ! { dg-warning "Code for reallocating the allocatable array" } 26r = sin(r) 27r = sin(r(1)) ! no realloc 28b = sin(r(1)) ! { dg-warning "Code for reallocating the allocatable variable" } 29 30a = nar() ! { dg-warning "Code for reallocating the allocatable array" } 31a = nar2() ! { dg-warning "Code for reallocating the allocatable array" } 32contains 33 function nar() 34 integer,allocatable :: nar(:) 35 end function 36 function nar2() 37 integer :: nar2(8) 38 end function 39end 40