https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67540
--- Comment #10 from Dominique d'Humieres <dominiq at lps dot ens.fr> --- > This test case is wrong. Well, I don't if strings comparison is allowed or forbidden by the standard when one string is a non-associated pointer as in program test implicit none call source_check() contains subroutine source_check() character(len=:), pointer :: str4 str4 => null() print *, (str4 < '1') end subroutine source_check end program test which gives ../../../p_work/libgfortran/intrinsics/string_intrinsics_inc.c:90:7: runtime error: null pointer passed as argument 1, which is declared to never be null T If this is forbidden by the standard, the test could be fixed with --- /opt/gcc/_clean/gcc/testsuite/gfortran.dg/allocate_deferred_char_scalar_1.f03 2011-02-23 16:42:20.000000000 +0100 +++ allocate_deferred_char_scalar_1.f03 2017-04-13 14:49:35.000000000 +0200 @@ -36,7 +36,8 @@ contains if(.not.associated(str4, str)) call abort() str4 => null() str = '12a56b78' - if(str4 == '12a56b78') call abort() +! if(str4 == '12a56b78') call abort() + if(associated(str4)) call abort() str4 = 'ABCDEFGH' if(str == 'ABCDEFGH') call abort() allocate(str5, source=str) @@ -65,7 +66,8 @@ contains if(.not.associated(str4, str)) call abort() str4 => null() str = 4_'12a56b78' - if(str4 == 4_'12a56b78') call abort() +! if(str4 == 4_'12a56b78') call abort() + if(associated(str4)) call abort() str4 = 4_'ABCDEFGH' if(str == 4_'ABCDEFGH') call abort() allocate(str5, source=str) If it is allowed, then null pointers should be handled in compare_string (gfc_charlen_type len1, const CHARTYPE *s1, gfc_charlen_type len2, const CHARTYPE *s2) > It dereferences thrice a NULL pointer str4. I see it only twice.