1! { dg-do run } 2! 3! This tests that common blocks function with multiply nested modules. 4! Contributed by Paul Thomas <pault@gcc.gnu.org> 5! 6 module mod0 7 complex(kind=8) FOO, KANGA 8 common /bar/ FOO, KANGA 9 contains 10 subroutine eyeore () 11 FOO = FOO + (1.0d0, 0.0d0) 12 KANGA = KANGA - (1.0d0, 0.0d0) 13 end subroutine eyeore 14 end module mod0 15 module mod1 16 use mod0 17 complex ROBIN 18 common/owl/ROBIN 19 end module mod1 20 module mod2 21 use mod0 22 use mod1 23 real(kind=8) re1, im1, re2, im2, re, im 24 common /bar/ re1, im1, re2, im2 25 equivalence (re1, re), (im1, im) 26 contains 27 subroutine tigger (w) 28 complex(kind=8) w 29 if (FOO.ne.(1.0d0, 1.0d0)) call abort () 30 if (KANGA.ne.(-1.0d0, -1.0d0)) call abort () 31 if (ROBIN.ne.(99.0d0, 99.0d0)) CALL abort () 32 if (w.ne.cmplx(re,im)) call abort () 33 end subroutine tigger 34 end module mod2 35 36 use mod2 37 use mod0, only: w=>foo 38 w = (0.0d0, 1.0d0) ! Was foo but this is forbidden (11.3.2) 39 KANGA = (0.0d0, -1.0d0) 40 ROBIN = (99.0d0, 99.0d0) 41 call eyeore () 42 call tigger (w) 43 end 44