This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] PR fortran/81984 -- Placate the sanitizer
- From: Steve Kargl <sgk at troutmask dot apl dot washington dot edu>
- To: fortran at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Tue, 25 Dec 2018 20:42:28 -0800
- Subject: [PATCH] PR fortran/81984 -- Placate the sanitizer
- Reply-to: sgk at troutmask dot apl dot washington dot edu
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;