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 /libgfortran | |
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 'libgfortran')
-rw-r--r-- | libgfortran/ChangeLog | 6 | ||||
-rw-r--r-- | libgfortran/intrinsics/string_intrinsics.c | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 4a31e48..50ebaf2 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/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 Janne Blomqvist <jb@gcc.gnu.org> * io/io.h (find_or_create_unit): Correct export declaration. diff --git a/libgfortran/intrinsics/string_intrinsics.c b/libgfortran/intrinsics/string_intrinsics.c index eed41d7..1bc4ff2 100644 --- a/libgfortran/intrinsics/string_intrinsics.c +++ b/libgfortran/intrinsics/string_intrinsics.c @@ -109,7 +109,7 @@ compare_string (GFC_INTEGER_4 len1, const char * s1, const char *s; int len; - res = strncmp (s1, s2, (len1 < len2) ? len1 : len2); + res = memcmp (s1, s2, (len1 < len2) ? len1 : len2); if (res != 0) return res; |