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
+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
--- /dev/null
+! { 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
+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.
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;