http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52724
Tobias Burnus <burnus at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2012-04-02 CC| |burnus at gcc dot gnu.org Ever Confirmed|0 |1 --- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-04-02 20:01:08 UTC --- (In reply to comment #2) > I am curious about what this line is doing: character buffer4(100) buffer4 = 4_'123' Well, that line does what it should do: It assign the value '123' - trimmed to one character (namely '1') to the array buffer4. The array4 then contains 100 times the value '1'. (In reply to comment #0) > read(buffer4,*) i > print *,i > end > ig25@linux-fd1f:~/Krempel/Opt> gfortran foo.f90 > ig25@linux-fd1f:~/Krempel/Opt> ./a.out > 1 And seemingly that's also what Thomas gets. * * * (In reply to comment #2) > buffer4 is a kind=1 variable. have you tried: > character(kind=4) buffer4(100) ? Well, with len=1,kind=4 or with len=2,kind=2 one gets, respectively, 1 and 12 - which is the expected result. However, the following fails: character(len=2,kind=4) buffer4(100) integer i buffer4 = 4_'123' read(buffer4,*) i print *,i end Fortran runtime error: Bad integer for item 1 in list input Printing the value of the array as "print *, buffer4", one gets the expected " 121212...." as output. And reading the line as read(buffer4,'(i5)') i works and yields "12". Only when replacing the formatted read by a list-directed read, it fails.