------- Comment #2 from dominiq at lps dot ens dot fr  2007-10-12 22:18 -------
Subject: Re:  Unequal character lengths in MERGE intrinsic
 not detected at run time

> scalar ("string") is conformable with any array (such as "tmp")

Yes, I missed that, so if the length of string is only known at runtime,
it can only be caught at run time, however the Portland Group Fortran
detects it at compile time (constant folding?).

Now I have another odd result: the following code

  character(len=1)  :: string = "z"
  character(len=20) :: tmp = ""
  tmp = Upper ("abcdefgh")
  print *, tmp
 contains
  Character (len=20) Function Upper (string)
    Character(len=*) string
    print *, len(string)
    print *, size(transfer(string,"xy",len(string)))
    Upper = ""
    Upper(1:2) =                                                               
&
     transfer(merge(transfer(string,"xy",len(string)),    &
       string(1:2), .true.), "xy")
    return
  end function Upper
end

gives

 8
 8
 ab                  

with xlf, g95, Intel and PGF, but gfortran gives:

           8
           4
 ab                  

a bug or an ambiguity of the transfer definition?


-- 


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

Reply via email to