This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/34246] gfortran.dg/bind_c_usage_16.f03 doesn't work
- From: "burnus at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 10 Dec 2007 18:36:58 -0000
- Subject: [Bug fortran/34246] gfortran.dg/bind_c_usage_16.f03 doesn't work
- References: <bug-34246-682@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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