Hi,
to furhter add to the topics to discuss, I noticed that Fortran FE seems to be 
quite
ambivalent about C_CHAR type:
[jh@gcc2-power8 gcc]$ cat ../b.f90
! This testcase will abort if C_CHAR types are not interoperable
module lto_type_merge_test
  use, intrinsic :: iso_c_binding
  implicit none

contains
  function types_test1(V) bind(c)
    USE, INTRINSIC :: ISO_C_BINDING
    CHARACTER(C_CHAR) :: types_test1
    CHARACTER(C_CHAR), VALUE :: V
    types_test1 = V
  end function types_test1
end module lto_type_merge_test

[jh@gcc2-power8 gcc]$ cat ../a.c
extern unsigned char types_test1 (char v);
void
main ()
{ 
  if (types_test1 ('a') != 'a')
    __builtin_abort ();
  return 0;
}

As my fortran-fu goes, i think this testcase is correct. Fortran FE however
builds types_test1 as a function return char but taking the array of size of 1
as a parameter.  I think it is just kind of coincidence that those are passed 
the
same way for x86-64 and may not be quite the case for other targets.

If the testcase seems valid, I would like to commit it to the non-LTO testsuite
so we get this tested.

With LTO we get bogus types mismatch warning and types_test1 won't be inlined
for this reason.

Honza

Reply via email to