https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90329

--- Comment #32 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
BTW, as can be seen on https://fortran.godbolt.org/z/ckMt1t
it is a pure luck that these bogus C/C++ wrappers seem to work, if one tries
simple
subroutine foo (a, b, c, d, e, f, g, h)
  integer :: b, c, d, e, f, g, h
  character(len=1) :: a
  call bar (a, b, c, d, e, f, g, h)
end subroutine foo
then at -O2 both older gfortran and ifort emit a tail call, which will
overwrite the hidden string length argument, so if one prototypes this as
void foo_ (char *a, blas_int b, blas_int c, blas_int d, blas_int e, blas_int f,
blas_int g, blas_int h);
and calls it with say foo_ ("1", 2, 3, 4, 5, 6, 7, 8); then it will overwrite
some variables in the caller both with older gfortran and with ifort.

Reply via email to