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

--- Comment #4 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
(In reply to Janne Blomqvist from comment #3)
> Ooof!
> 
> (Just for the record, I don't think we should revert to the previous
> behavior. Whatever we do should be robust in the face of LTO etc.)

I concur.

> I'd rather not see extra command-line arguments. For something which
> modifies the ABI and somehow works by accident part of the time, this is
> just too difficult to keep track of for end users, IMHO.
> 
> My suggestions:
> 
> 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?

Unfortunately, this would not work :-(

While looking at the R source, I have also found some occurences
where 'F' was spelled out 'Full'.

Also, what could be done with CALL FOO ('a', 'bcd') ?

> 2) External procedures with character arguments are compiled and called as
> varargs functions. This is what Thomas is suggesting, except unconditionally
> and not controlled by an option.

Not an option, unfortunately :-(

This would bring back PR 87689, and this was an ABI breakage on
a primary GCC platform (POWER) with perfectly standard-compliant
code.

> I'm not really happy with either of these, but the third option, of fixing
> all Fortran-calling code out there isn't realistic either.

Currently, I am leaning towards using an option with a mandatory
warning (no way to turn it off) which does not push any string lenghts
onto the stack at all, something like -fbroken-character-abi,
which we would use for external procedures without an explicit interface.

The warning would have to be mandatory to a) point people towards what's
wrong with their code, and b) avoid questions of "why does my code
no longer work".

I can also extend -fc-prototypes so that it also issues prototypes
for any global procedures outside of BIND(C), or add a new option.

Reply via email to