This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RFC: Help me understand this


Hi folks,

I have been exploring Dominique's comment 19 to pr31610. I think there is something else going on here. Maybe someone can help me understand.

With this exploratory case.

character(len=20) :: string
character(len=20) :: outstr
character(len=1)  :: c, x
logical :: a(20)
c = "A"
x = "x"
string = "jjjjjjjjjjjjjjjjjjjj"
outstr = "rrrrrrrrrrrrrrrrrrrr"
a = .true.
outstr = transfer (merge (transfer(c, x, 20), "b", a), string )
write(*,*) oustr
end

Looking at the -fdump-tree-original, the write statement is coming out as:

    _gfortran_st_write (&dt_parm.5);
    _gfortran_transfer_real (&dt_parm.5, &oustr, 4);
    _gfortran_st_write_done (&dt_parm.5);

Transferring a real. I don't get this. Intel ifort does the same thing, except ifort default initializes is variables so it writes a zero:

$ gfc test3.f90
$ ./a.out
 -3.03201908E-13
$ ifort test3.f90
$ ./a.out
  0.0000000E+00

Any insight would be appreciated.

Jerry


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]