I have been encountering an error with a FORTRAN program that I was able to narrow down to possibly a compiler issue. Here is a short example code that throws the error:
program test implicit none character(len=12) :: test1(2),test2(2) test1=(/'1234567890','123456789'/) test2=(/'123456789','1234567890'/) print *,'Test 1 ',test1 print *,'Test 2 ',test2
On my machine, I get the following output:
Test 1 1234567890 123456789 Test 2 123456789 123456789
Now, maybe there is some obscure FORTRAN rule (not the rarest thing in the world) that causes this to occur–that when I have a character array with more than one element and the elements are of different length, the the final element’s trailing 0 is removed.
I use these arrays as flags during loops, so I am luckily able to use test1 instead of test2. For rigor, I use gfortran to compile the same program and get this output when running:
Test 1 1234567890 123456789 Test 2 123456789 1234567890
Anyone have any suggestions or experiencing the same problem? For the record, I am using pgf90 11.10-0.