------- Comment #13 from burnus at gcc dot gnu dot org  2007-12-10 18:36 -------
> As noted, the test in comment #6 gives an ICE 

The ENTRY fix needs to go into build_entry_thunks:
      if (thunk_sym->attr.function)
        {
          if (gfc_return_by_reference (ns->proc_name))
            {
This branch is entered as the master function,  proc_name, is is_bind_c ==
false, but it fails currently if (thunk_sym->attr.is_bind_c &&
thunk_sym->ts.type == BT_CHARACTER).

The proper tree should looks more or less as follows:

test2 ()
{
  character(kind=1) tmp[1:1];
  integer(kind=4) len;
  master.0.test2 (0, &tmp, len);
  return tmp[1];

That is test() itself returns a scalar character, but master.0.test2 takes the
string as argument, which allows to combine bind(C) with non-bind(C) functions
and allows for different string lengths of ENTRY and function (cf. PR 34421).


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34246

Reply via email to