This is the mail archive of the
mailing list for the GNU Fortran project.
deferred-length character bug in optimized code
- From: "Rouson, Damian" <rouson at sandia dot gov>
- To: "fortran at gcc dot gnu dot org" <fortran at gcc dot gnu dot org>
- Date: Mon, 11 Jun 2012 21:56:57 +0000
- Subject: deferred-length character bug in optimized code
I know the support for deferred-length character variables is evolving, but in case this issue isn't already known, below is a simple test case that demonstrates a problem that only appears in optimized code. The first result below is the correct output. The second result is the output at optimization levels -O1, -O2, and -O3. Please let me know if I should submit a new PR.
$ cat trim.f90
character(len=4) :: string="123 "
character(:), allocatable :: trimmed
trimmed = trim(string)
$ gfortran trim.f90
$ gfortran -O1 trim.f90