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/char_pointer_assign.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/char_pointer_assign.f90')
-rw-r--r-- | gcc/testsuite/gfortran.dg/char_pointer_assign.f90 | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/char_pointer_assign.f90 b/gcc/testsuite/gfortran.dg/char_pointer_assign.f90 new file mode 100644 index 000000000..62fcf0360 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/char_pointer_assign.f90 @@ -0,0 +1,44 @@ +! { dg-do run } +! { dg-options "-std=legacy" } +! +program char_pointer_assign
+! Test character pointer assignments, required
+! to fix PR18890 and PR21297
+! Provided by Paul Thomas pault@gcc.gnu.org
+ implicit none
+ character*4, target :: t1
+ character*4, target :: t2(4) =(/"lmno","lmno","lmno","lmno"/)
+ character*4 :: const
+ character*4, pointer :: c1, c3
+ character*4, pointer :: c2(:), c4(:) + allocate (c3, c4(4))
+! Scalars first.
+ c3 = "lmno" ! pointer = constant
+ t1 = c3 ! target = pointer
+ c1 => t1 ! pointer =>target
+ c1(2:3) = "nm"
+ c3 = c1 ! pointer = pointer
+ c3(1:1) = "o"
+ c3(4:4) = "l"
+ c1 => c3 ! pointer => pointer
+ if (t1 /= "lnmo") call abort ()
+ if (c1 /= "onml") call abort ()
+
+! Now arrays.
+ c4 = "lmno" ! pointer = constant
+ t2 = c4 ! target = pointer + c2 => t2 ! pointer =>target + const = c2(1) + const(2:3) ="nm" ! c2(:)(2:3) = "nm" is still broken
+ c2 = const
+ c4 = c2 ! pointer = pointer
+ const = c4(1) + const(1:1) ="o" ! c4(:)(1:1) = "o" is still broken
+ const(4:4) ="l" ! c4(:)(4:4) = "l" is still broken
+ c4 = const
+ c2 => c4 ! pointer => pointer
+ if (any (t2 /= "lnmo")) call abort ()
+ if (any (c2 /= "onml")) call abort ()
+ deallocate (c3, c4)
+end program char_pointer_assign + |