summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/char_pointer_assign_2.f90
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gfortran.dg/char_pointer_assign_2.f90')
-rw-r--r--gcc/testsuite/gfortran.dg/char_pointer_assign_2.f9011
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/char_pointer_assign_2.f90 b/gcc/testsuite/gfortran.dg/char_pointer_assign_2.f90
new file mode 100644
index 000000000..c67bbb4af
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/char_pointer_assign_2.f90
@@ -0,0 +1,11 @@
+! { dg-do compile }
+! Tests the fix for PRs20895 and 25030, where pointer assignments
+! of different length characters were accepted.
+ character(4), target :: ch1(2)
+ character(4), pointer :: ch2(:)
+ character(5), pointer :: ch3(:)
+
+ ch2 => ch1 ! Check correct is OK
+ ch3 => ch1 ! { dg-error "Unequal character lengths \\(5/4\\)" }
+
+end