This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/33759] Unequal character lengths in MERGE intrinsic not detected at run time
- From: "dominiq at lps dot ens dot fr" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 12 Oct 2007 22:18:45 -0000
- Subject: [Bug fortran/33759] Unequal character lengths in MERGE intrinsic not detected at run time
- References: <bug-33759-12313@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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