This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: ICE on valid
>> > Thanks for confirming, and for figuring out that this is actually invalid
>> > code. In this case my goal was just to pass a pointer to a Fortran
>> > polymorphic variable through to the C-side of my code, and then be able
>> > to pass that pointer back later on.
>>
>> if you do that, then I guess you have to convert your Fortran
>> polymorphic pointer to a C_PTR at some point, probably via C_LOC,
>> right? However, C_LOC should not accept polymorphic arguments in the
>> first place. Haven't you been bitten by this?
>
> I haven't tried working around this yet, but my idea was to wrap the
> polymorphic object in a derived type:
My question was actually not so much targeted towards your future
workaround, but more as to why you're not getting any errors from
C_LOC, when converting your Fortran CLASS pointer to a C pointer
(which is sort of the opposite of what C_F_POINTER does) ...
(But probably what you're doing is just different from what I'm
imagining you would do.)
Cheers,
Janus