[Bug fortran/90329] Incompatibility between gfortran and C lapack calls
jb at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun May 5 12:52:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90329
--- Comment #8 from Janne Blomqvist <jb at gcc dot gnu.org> ---
(In reply to Janne Blomqvist from comment #3)
> 1) When compiling an external procedure, for character(len=1) arguments we
> don't generate the hidden string length argument. And similarly when calling
> an external procedure, if a len=1 character is passed, we omit the hidden
> string length argument. This, I believe, is what Paul is suggesting in the
> previous comment?
Having already shot down my (2) proposal, I thought a bit more about this one,
that is omitting the hidden length argument for dummy arguments with len=1, and
when calling a procedure with a len=1 argument.
Unfortunately, beyond being a somewhat fragile heuristic, it's also
fundamentally broken. Consider
subroutine foo(a)
character(len=1) :: a
...
end subroutine foo
So with this suggestion, this procedure would be generated without the hidden
length argument. The brokenness comes from
call foo("ab")
which would generate a call to a procedure WITH the hidden string length
argument. However, this code is perfectly standard conforming, F2018 15.5.2.4
says that a character dummy argument must have a length less than or equal to
the actual argument, which is fulfilled by the above (1 <= 2). That is, we
can't special case len=1 procedures and calls in any way.
More information about the Gcc-bugs
mailing list