https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120049
kargls at comcast dot net changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kargls at comcast dot net
--- Comment #6 from kargls at comcast dot net ---
(In reply to Jerry DeLisle from comment #4)
> Vincent was able to reduce this further. Two files, gtk_sup.f90 and test.f90.
>
> $ cat gtk_sup.f90
> module gtk_sup
> use, intrinsic :: iso_c_binding
> end module gtk_sup
...
> Anyone have any thoughts?
The iso_c_binding module is created on-the-fly. Trying to write
it out to a user's module seems to be rather dubious.
If iso_c_binding is available, c_ptr_2 has
(gdb) p *c_ptr_2->value.function->isym
$1 = {name = 0x8048197d8 "c_loc", lib_name = 0x804833150 "_gfortran_c_loc",
formal = 0x804189140, ts = {type = BT_DERIVED, kind = 0, u = {
derived = 0x804042900, cl = 0x804042900, pad = 67381504},
interface = 0x0, is_c_interop = 1, is_iso_c = 0, f90_type = BT_VOID,
deferred = false, interop_kind = 0x0}, elemental = 0, inquiry = 1,
transformational = 0, pure = 1, generic = 0, specific = 0, actual_ok = 0,
If one looks at the -fdump-tree-original, one sees that c_loc and
c_associated are in-lined
{
void * D.4657;
logical(kind=4) D.4658;
D.4657 = (void *) &val;
D.4658 = val != 0B && val == D.4657;
_gfortran_transfer_logical_write (&dt_parm.0, &D.4658, 4);
}
and in fact the type is 'void *'.
Now, if one tries to get c_loc's info from the gtk_sup module, you end up with
(gdb) p *c_ptr_2->value.function->isym
$1 = {name = 0x8048197d8 "c_loc", lib_name = 0x804833150 "_gfortran_c_loc",
formal = 0x804189140, ts = {type = BT_VOID, kind = 0, u = {derived = 0x0,
cl = 0x0, pad = 0}, interface = 0x0, is_c_interop = 0, is_iso_c = 0,
f90_type = BT_UNKNOWN, deferred = false, interop_kind = 0x0},
elemental = 0, inquiry = 1, transformational = 0, pure = 1, generic = 0,
specific = 0, actual_ok = 0, noreturn = 0, conversion = 0, from_module = 1,
vararg = 0, standard = 16, simplify = {f0 = 0x0, f1 = 0x0, f2 = 0x0,
If one short-circuits the check with
if (c_ptr_2->ts.type == BT_VOID)
return true;
then everthing compiles and runs.