This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] PR fortran/81984 -- Placate the sanitizer


Tested on i586-*-freebsd.  OK to commit?

2018-12-25  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/81984
	* intrinsics/string_intrinsics_inc.c: Placate the sanitizer.

-- 
Steve
Index: libgfortran/intrinsics/string_intrinsics_inc.c
===================================================================
--- libgfortran/intrinsics/string_intrinsics_inc.c	(revision 267418)
+++ libgfortran/intrinsics/string_intrinsics_inc.c	(working copy)
@@ -87,6 +87,14 @@ compare_string (gfc_charlen_type len1, const CHARTYPE 
   gfc_charlen_type len;
   int res;
 
+  /* Placate the sanitizer.  */
+  if (!s1 && !s2)
+    return 0;
+  if (!s1)
+    return -1;
+  if (!s2)
+    return 1;
+
   res = MEMCMP (s1, s2, ((len1 < len2) ? len1 : len2));
   if (res != 0)
     return res;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]