https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90329
Bug ID: 90329
Summary: Incompatibility between gfortran and C lapack calls
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: tkoenig at gcc dot gnu.org
Target Milestone: ---
The fix for PR 87689 (ABI violation on POWER) has led to problems
with what some C programs expect as the Fortran calling convention
to be.
It seems that many C codes assume that no hidden string length is
passed for a one-character string. This is wrong (and has been wrong
since the days of the original Fortran compiler for Unix), but
the code exists, and we should recommend a solution for it.
This is important because C interfaces to LAPACK, as central a piece
of software as you can find, is impacted by this.
This has been quite extensively debugged by the R people, see
https://gcc.gnu.org/ml/fortran/2019-05/msg00021.html . On x86_64,
Tomas Kalibera found that, while things "mostly" worked, a tail
call was causing problems because the stack space for the length
was not allocated. -fno-optimize-sibling-calls seems to cure it,
but that may not be the only thing affected by this.
Note that this applies to gcc 7, gcc 8, gcc 9 and gcc 10, since the
patch was applied to all open branches at the time (an ABI violation
on a primary platform was deemed important enough).