-ff2c question: Complex type in procedure calls (related to PR 30887 / %VAL())
Tobias Burnus
burnus@net-b.de
Thu Feb 22 20:06:00 GMT 2007
Hi,
I'm trying to fix PR 30887; I have, however, some problems with
understanding the -ff2c option.
In the test case, I have:
external c_to_c8
complex(8) u8, v8, w8, c_to_c8
[...]
v8 = c_to_c8 (%VAL (u8), %REF (w8), %LOC (w8))
gfortran -c -ff2c creates than the following tree:
{
complex4 cmplx.1;
c_to_c8 (&cmplx.1, u8, &w8, &&w8);
v8 = cmplx.1;
}
Is this on purpose that with -ff2c the return type is assumed to be 2*4
bytes instead of 2*8 bytes?
I think it is unlogical, but I have no experience at all with -ff2c.
(Without -ff2c the tree is: v8 = c_to_c8 (u8, &w8, &&w8); )
It is also not how I understand the manual:
"The calling conventions used by g77 (originally implemented in f2c)
require functions that return type default |REAL| to actually return the
C type |double|, and functions that return type |COMPLEX| to return the
values via an extra argument in the calling sequence that points to
where to store the return value. Under the default GNU calling
conventions, such functions simply return their results as they would in
GNU C---default |REAL| functions return the C type |float|, and
|COMPLEX| functions return the GNU C type |complex|. "
I don't see anything which indicates that COMPLEX is returned as a float
tuple; actually, from the text I would have rather assumed that
"complex" might be a double touple instead of a float tuple, not the
other way round.
(I think I should create a new test case using the GNU calling
convention rather than extending the -ff2c one as -ff2c puzzles me all
the time.)
Tobias
-------------- next part --------------
A non-text attachment was scrubbed...
Name: val.diff
Type: text/x-patch
Size: 5459 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20070222/9fbcd851/attachment.bin>
More information about the Fortran
mailing list