diff options
Diffstat (limited to 'gcc/testsuite/gfortran.dg/string_null_compare_1.f')
-rw-r--r-- | gcc/testsuite/gfortran.dg/string_null_compare_1.f | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/string_null_compare_1.f b/gcc/testsuite/gfortran.dg/string_null_compare_1.f new file mode 100644 index 000000000..659b3eb37 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/string_null_compare_1.f @@ -0,0 +1,17 @@ +! { dg-do run } +! { dg-options "-std=legacy" } +! +! PR 27784 - Different strings should compare unequal even if they +! have CHAR(0) in them. + + program main + character*3 str1, str2 + call setval(str1, str2) + if (str1 == str2) call abort + end + + subroutine setval(str1, str2) + character*3 str1, str2 + str1 = 'a' // CHAR(0) // 'a' + str2 = 'a' // CHAR(0) // 'c' + end |