f95 long string bug workaround
Recently I reported a bug in Sun f95 (internal review ID 926528) in which initializing a character variable with length > 1024 made the compiler crash. The offending program:
PROGRAM sunbuglongstring ! character*1025
CHARACTER:: longstring*1025='<'//repeat('.',1023)//'>'
PRINT '(1X,2A)',longstring(1:1),longstring(1025:1025)
END PROGRAM sunbuglongstring
ought to print <>. After sending that bug report I found a simple workaround: separate the initialization from the declaration by
PROGRAM sunbuglongstring1 ! character*1025
CHARACTER:: longstring*1025
longstring = '<'//repeat('.',1023)//'>'
PRINT '(1X,2A)',longstring(1:1),longstring(1025:1025)
END PROGRAM sunbuglongstring1
which compiled and ran OK.