This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [gfortran] Fix PR 20178: Implement g77 / f2c calling conventions


At 07:32 AM 3/5/2005, Tobias Schlüter wrote:


Until I mentioned it on the mailing list, noone had complained that we didn't
implement a calling convention compatible with g77.  Unfortunately, people
seem to care, so I implemented it.

The g77 calling convention requires two things for function results that we
didn't do:
- scalar COMPLEX functions return via a hidden argument
- default REAL functions return a C double

I implemented this, but it is currently only enabled via a command-line
option.  If we decide that this is the right way, I propose making
-fno-second-underscore the default also, as compatibility with g77 will then
not be required for this either.

If on the other hand we decide that the f2c calling convention should be the
default (I'm against it, see the PR's audit trail for a few arguments in both
ways), someone should implement the necessary fixes to those routines in
libgfortran that are affected by the calling conventions (i.e. those which can
be passed as an actual argument, and which are REAL*4 or COMPLEX).

As the terminology "f2c calling convention" implies, I understand that g77 adopted it mainly because f2c insisted on it for libf2c. It happened to fit well with the x87 and m68k architectures, but that argument isn't so compelling any longer. The confusion is perpetuated by the x86-64 ABI requiring default real function results to be passed in the 80-bit top of stack, so that functions built with or without -mfpmath=sse are compatible. A performance penalty is incurred in the normal sse code to enable this.
Maybe I was too long winded: the benefits of dropping f2c compatibility will be negated under the x86-64 ABI. I don't suppose the (different) Windows-x64 ABI has enough importance to influence the decision (gcc/gfortran may never conform to it), but that would argue against f2c compatibility.



Tim Prince



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]