1! { dg-do run } 2! { dg-options "-ff2c" } 3! Verifies that complex pointer results work with -ff2c 4! try all permutations of result clause in function yes/no 5! and result clause in interface yes/no 6! this is not possible in Fortran 77, but this exercises a previously 7! buggy codepath 8function c() result (r) 9 common // z 10 complex, pointer :: r 11 complex, target :: z 12 13 r=>z 14end function c 15 16function d() 17 common // z 18 complex, pointer :: d 19 complex, target :: z 20 21 d=>z 22end function d 23 24function e() 25 common // z 26 complex, pointer :: e 27 complex, target :: z 28 29 e=>z 30end function e 31 32function f() result(r) 33 common // z 34 complex, pointer :: r 35 complex, target :: z 36 37 r=>z 38end function f 39 40interface 41 function c () 42 complex, pointer :: c 43 end function c 44end interface 45interface 46 function d() 47 complex, pointer :: d 48 end function d 49end interface 50interface 51 function e () result(r) 52 complex, pointer :: r 53 end function e 54end interface 55interface 56 function f () result(r) 57 complex, pointer :: r 58 end function f 59end interface 60 61common // z 62complex, target :: z 63complex, pointer :: p 64 65z = (1.,0.) 66p => c() 67z = (2.,0.) 68if (p /= z) STOP 1 69 70NULLIFY(p) 71p => d() 72z = (3.,0.) 73if (p /= z) STOP 2 74 75NULLIFY(p) 76p => e() 77z = (4.,0.) 78if (p /= z) STOP 3 79 80NULLIFY(p) 81p => f() 82z = (5.,0.) 83if (p /= z) STOP 4 84end 85