Commit 07b700ea by Steven G. Kargl

re PR libfortran/81984 (NULL string pointer dereferencing forces undefined…

re PR libfortran/81984 (NULL string pointer dereferencing forces undefined behaviour in libgfortran)

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

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

From-SVN: r267452
parent 691adeb0
2018-12-28 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/81984
* intrinsics/string_intrinsics_inc.c: Placate the sanitizer.
2018-12-21 Steven G. Kargl <kargl@gcc.gnu.org> 2018-12-21 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/69121 PR fortran/69121
......
...@@ -87,6 +87,14 @@ compare_string (gfc_charlen_type len1, const CHARTYPE *s1, ...@@ -87,6 +87,14 @@ compare_string (gfc_charlen_type len1, const CHARTYPE *s1,
gfc_charlen_type len; gfc_charlen_type len;
int res; 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)); res = MEMCMP (s1, s2, ((len1 < len2) ? len1 : len2));
if (res != 0) if (res != 0)
return res; return res;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment