1 Jan 2009 20:29
min/max and string arguments
Daniel Franke <franke.daniel <at> gmail.com>
2009-01-01 19:29:26 GMT
2009-01-01 19:29:26 GMT
Happy new year, everyone!
Let's start this year with a small puzzle :)
What should be the proper output of this code fragment?
print *, MIN ("foo", "", "bar")
end
gfortran answers "bar" while an equivalent C-fragment using strcmp() would
result in "". gfortran's behavior becomes especially interesting with:
min("", " ") -> " "
max("", " ") -> " "
while one would probably expect "" and " " respectively?!
How do other compilers handle this? Intel 10.1, the only other one I have
access to, does not accept string arguments.
Thanks!
Daniel
The chunk of code in resolve_call that checks host association was
substituting the symbol for the correct procedure and popping it on to
the symtree. This was OK for generic procedures, such as in
host_assoc_call_3.f90. This latter was what triggered the
introduction of this bit of code. I missed the fact that it failed
for specific references. This patch fixes that by looking for the
symtree and substituting that in the call, except for generic
references.
Bootstrapped and regtested on FC9/x86_i64 - OK for trunk?
Cheers
Paul
2009-01-03 Paul Thomas <pault <at> gcc.gnu.org>
PR fortran/35820
* resolve.c (resolve_call): When searching for proper host
association, use symtree rather than symbol. For everything
except generic subroutines, substitute the symtree in the call
rather than the symbol.
RSS Feed