https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67540
Bug ID: 67540 Summary: string_intrinsics_inc.c sanitizer detects null pointer passed to memcpy Product: gcc Version: 5.2.0 Status: UNCONFIRMED Severity: minor Priority: P3 Component: libfortran Assignee: unassigned at gcc dot gnu.org Reporter: zeccav at gmail dot com Target Milestone: --- During make check-fortran in gcc build the sanitizer complains that a null pointer is passed to memcpy in string_intrinsics_inc.c:89 res = MEMCMP (s1, s2, ((len1 < len2) ? len1 : len2)); string_intrinsics_inc.c:90:7: runtime error: null pointer passed as argument 1, which is declared to never be null because s1 == NULL My fix is int lvz=len1 < len2 ? len1 : len2; if(lvz) res = MEMCMP (s1, s2, lvz); else res=0;