diff options
author | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
---|---|---|
committer | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
commit | 554fd8c5195424bdbcabf5de30fdc183aba391bd (patch) | |
tree | 976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/gfortran.dg/module_commons_3.f90 | |
download | cbb-gcc-4.6.4-upstream.tar.bz2 cbb-gcc-4.6.4-upstream.tar.xz |
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig;
imported gcc-4.6.4 source tree from verified upstream tarball.
downloading a git-generated archive based on the 'upstream' tag
should provide you with a source tree that is binary identical
to the one extracted from the above tarball.
if you have obtained the source via the command 'git clone',
however, do note that line-endings of files in your working
directory might differ from line-endings of the respective
files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/gfortran.dg/module_commons_3.f90')
-rw-r--r-- | gcc/testsuite/gfortran.dg/module_commons_3.f90 | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/module_commons_3.f90 b/gcc/testsuite/gfortran.dg/module_commons_3.f90 new file mode 100644 index 000000000..a57863e9a --- /dev/null +++ b/gcc/testsuite/gfortran.dg/module_commons_3.f90 @@ -0,0 +1,57 @@ +! { dg-do run } +! +! PR fortran/38657, in which the mixture of PRIVATE and +! COMMON in TEST4, would mess up the association with +! TESTCHAR in TEST2. +! +! Contributed by Paul Thomas <pault@gcc.gnu.org> +! From a report in clf by Chris Bradley. +! +MODULE TEST4 + PRIVATE + CHARACTER(LEN=80) :: T1 = & + "Mary had a little lamb, Its fleece was white as snow;" + CHARACTER(LEN=80) :: T2 = & + "And everywhere that Mary went, The lamb was sure to go." + CHARACTER(LEN=80) :: TESTCHAR + COMMON /TESTCOMMON1/ TESTCHAR + PUBLIC T1, T2, FOOBAR +CONTAINS + subroutine FOOBAR (CHECK) + CHARACTER(LEN=80) :: CHECK + IF (TESTCHAR .NE. CHECK) CALL ABORT + end subroutine +END MODULE TEST4 + +MODULE TEST3 + CHARACTER(LEN=80) :: TESTCHAR + COMMON /TESTCOMMON1/ TESTCHAR +END MODULE TEST3 + +MODULE TEST2 + use TEST4 + USE TEST3, chr => testchar + PRIVATE + CHARACTER(LEN=80) :: TESTCHAR + COMMON /TESTCOMMON1/ TESTCHAR + PUBLIC TESTCHAR, FOO, BAR, CHR, T1, T2, FOOBAR +contains + subroutine FOO + TESTCHAR = T1 + end subroutine + subroutine BAR (CHECK) + CHARACTER(LEN=80) :: CHECK + IF (TESTCHAR .NE. CHECK) CALL ABORT + IF (CHR .NE. CHECK) CALL ABORT + end subroutine +END MODULE TEST2 + +PROGRAM TEST1 + USE TEST2 + call FOO + call BAR (T1) + TESTCHAR = T2 + call BAR (T2) + CALL FOOBAR (T2) +END PROGRAM TEST1 +! { dg-final { cleanup-modules "TEST2 TEST3 TEST4" } } |