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

burnus at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Mon Sep 24 17:26:00 GMT 2007



------- Comment #2 from burnus at gcc dot gnu dot org  2007-09-24 17:26 -------
(In reply to comment #0)
> When I compile the program listed below with the snapshot version of gfortran
> dated September 24 I get the following spurious warning:
> pp.f90:3.15:
> rft = TRANSFER(' ', 0.0)
>               1
> Warning: Intrinsic TRANSFER at (1) has partly undefined result:
>          source size 1 < result size 4

pinskia wrote:
> the warning is correct.

To elaborate:
  ' ' is 1 byte long
  0.0 is 4 bytes long
thus transfer initializes only 1 of the 4 bytes of rft, the rest remain
unchanged. You need to use "transfer('    ', 0.0)" to initialize all bytes.

If you have a suggestion how to improve the warning message or if you have any
other suggestion, I would be grateful.

I tried some compiles and the resulting rft is varying a lot:
4.484155086E-44, -4.1234682E-11, -2.4305621E-28, 1.0774349E+12


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu dot
                   |                            |org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33544



More information about the Gcc-bugs mailing list