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: Fortran's C_CHAR type


> I have had a look at the table and the text around, and first I should
> correct myself.
> C_CHAR is 1, C_SIGNED_CHAR is 1, and the default values for len= and
> kind= are 1 as well.
> So, even if CHARACTER(KIND=C_CHAR) is what should be used as it's not
> dependent on the implementation's default kind choice, it boils down to
> the same as CHARACTER(C_CHAR), namely CHARACTER(len=1, kind=1) actually.

Thanks for explanation - as I said I hardly wrote any Fortran code except
for these few testcases :))
> 
> 
> And about the line saying CHARACTER(KIND=C_CHAR) interoperable with char
> in table 15.2:
> You're right, while I would myself prefer to use an
> INTEGER(KIND=C_SIGNED_CHAR) type, CHARACTER(KIND=C_CHAR) should be
> supported as well.
> That means that char should be compatible with char[1], I think.
> You said there is no guarantee they are passed the same way?

With LTO we definitely don't consider the types compatible, so we produce bogus
warning.  Things may work on TBAA side because it basically ignores arrays, but
I am not 100% sure - will double check.

For passing conventions, it is definitely not a requirement of C ABI to pass arrays
of size 1 and scalars same way. I think there are ABIs passing scalars in registers
and everything else in memory (PPC SYSV ABI?).

If we consider my testcase defined, I would suggest simply adding it to testsuite
and lets see if something breaks.
> 
> 
> > If you can look at the other c-bind testcases I produced, I would really appreachiate that.
> I have looked at:
> https://gcc.gnu.org/ml/gcc-patches/2015-06/msg00693.html
> https://gcc.gnu.org/ml/gcc-patches/2015-06/msg00713.html
> I saw nothing wrong with the tests.
> Avoiding character interoperability avoids most of the pain. ;-)

Hehe, quite on the contrary, I would say that both Richard and me had quite some pain from
the rest of interoperability rules, too ;))

Honza
> 
> Mikael


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