------- Comment #8 from burnus at gcc dot gnu dot org  2007-05-29 14:05 -------
> In reducing this, I discovered that gfortran currently hangs on the following
> much simpler code.  I suspect that if we fix this, it'll fix the original code
> too.
>   write(*,*) transfer("A", "x", 20)

NAG f95 and g95 print for that case the (default-shown) warning:
  Warning: Intrinsic TRANSFER has partly undefined result
and
  Warning (148): Not enough data to produce the requested array size in
TRANSFER function at (1)

NAG f95, ifort and g95 print "A" (sunf95 prints "A2�Uh2�U").


Such a compile-time warning for transfer(...,...,size) would be also nice to
have in gfortran.


For the original test case (comment 0, see also comment 1):
- f95 and g95 print the same warning plus the error (g95: see comment 2):
  Error: Unequal character lengths (1 and 20) in MERGE intrinsic
- ifort accepts it and returns a zero-length string
- sunf95 prints an error (see comment 1)

> character(len=20) :: string
> logical :: a(20)
> write(*,*) transfer (merge (transfer("A", "x", 20), "b", a), string )
> end
This gives still a warning with g95 and NAG f95; NAG outputs "Abbbbbb",
ifort/g95/sunf95 show "bbbbbbbbbbbbbbbbbbbb".

I agree with Paul, NAGf95 and g95 that merge needs to have
same-character-length strings.


-- 

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=31610

Reply via email to