This is the mail archive of the mailing list for the GCC 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]

[Bug fortran/33544] Spurious warning in TRANSFER intrinsic in Sept 24 snapshot of gfortran

------- Comment #4 from burnus at gcc dot gnu dot org  2007-09-24 19:17 -------
> We may want to hide the warning behind a -Wshort-transfer option
> (or some other appropriate name).
Maybe; I think having a warning by default would be more reasonable but it
should be hideable.

> Afterall, if a programmer wrote 'rft = transfer(' ', 0.0)',
> then s/he probably meant it.

I sincerely doubt that the programmer meant that this piece of code produces
different results depending on the compiler and possibly some random value in
memory. For the given example, many compilers seem to initialize the result
with zero; example:

PROGRAM printd
REAL :: rft
rft = TRANSFER(' ', 0.0)
print *, rft
rft = TRANSFER(' '//achar(0)//achar(0)//achar(0), 0.0)
print *, rft

The second transfer produces: 4.4841551E-44
g95, ifort and openf95 seem to produce the same result also for the first
gfortran, NAG f95 and sunf95 have, however, a different result every time.

Thus, if one wants to argue that the programmer intended a certain value, I
would argue that it is the one using a zero-padded SOURCE.


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