$ cat string_null_compare_1.f program main character*3 str1, str2 call setval(str1, str2) if (str1 == str2) print *,'Should be unqual' end
subroutine setval(str1, str2) character*3 str1, str2 str1 = 'a' // CHAR(0) // 'a' str2 = 'a' // CHAR(0) // 'c' end $ gfortran string_null_compare_1.f $ ./a.out Should be unqual $ g77 string_null_compare_1.f $ ./a.out $ -- Summary: Comparison of strings with char(0) Product: gcc Version: 4.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libfortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: tkoenig at gcc dot gnu dot org OtherBugsDependingO 19292 nThis: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27784