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

--- Comment #19 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
This is worse than I thought.

It seems that, if we compile

subroutine foo(a)
  real :: a
end subroutine foo

program main
  real :: x
  call foo(x)
end program main

we call build_function_type_vec (type, typelist)

and if we just compile

program main
  real :: x
  call foo(x)
end program main

we call build_varargs_function_type_vec (type, typelist);

(which is in trans-types.c (gfc_get_function_type), in the
code snippet

  if (is_varargs)
    type = build_varargs_function_type_vec (type, typelist);
  else
    type = build_function_type_vec (type, typelist);
  type = create_fn_spec (sym, type);

This only "works" for calling conventions where varargs
do not matter.

Now, this is caller-side, so I do not think a fix to
generate the correct function decl from the call should
hurt.

I guess that if we really fix this one, we will also fix quite a few
latent bugs...

Reply via email to