diff options
author | Thomas Koenig <Thomas.Koenig@online.de> | 2006-05-28 20:25:15 +0000 |
---|---|---|
committer | Thomas Koenig <tkoenig@gcc.gnu.org> | 2006-05-28 20:25:15 +0000 |
commit | 6545ef83c162894776c23e0a9811d6cadc1bff66 (patch) | |
tree | d10973bffbe6cff83f2b74ebd3c5762ac2392da0 /gcc | |
parent | 375277f69d4536e142609d553df186586ee4ac8a (diff) | |
download | gcc-6545ef83c162894776c23e0a9811d6cadc1bff66.zip gcc-6545ef83c162894776c23e0a9811d6cadc1bff66.tar.gz gcc-6545ef83c162894776c23e0a9811d6cadc1bff66.tar.bz2 |
string_intrinsics.c (compare_string): Use memcmp instead of strncmp to avoid tripping over CHAR(0) in a string.
2006-05-28 Thomas Koenig <Thomas.Koenig@online.de>
* intrinsics/string_intrinsics.c (compare_string):
Use memcmp instead of strncmp to avoid tripping over
CHAR(0) in a string.
2006-05-28 Thomas Koenig <Thomas.Koenig@online.de>
* gfortran.dg/string_null_compare_1.f: New test case.
From-SVN: r114175
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/string_null_compare_1.f | 15 |
2 files changed, 21 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 786b6ca..96c5729 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2006-05-28 Thomas Koenig <Thomas.Koenig@online.de> + + * intrinsics/string_intrinsics.c (compare_string): + Use memcmp instead of strncmp to avoid tripping over + CHAR(0) in a string. + 2006-05-27 Richard Guenther <rguenther@suse.de> PR middle-end/27773 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 0000000..2e6eb1b --- /dev/null +++ b/gcc/testsuite/gfortran.dg/string_null_compare_1.f @@ -0,0 +1,15 @@ +! { dg-do run } +! 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 |