On 5/18/25 2:34 PM, Jerry D wrote:
On 5/18/25 2:10 PM, Harald Anlauf wrote:
Hi Jerry,

I found 2 corner invalid cases which are silently accepted with
your patch when iso_c_binding is used indirectly:

   print *, c_associated(c_loc(val), C_NULL_FUNPTR)
   print *, c_associated(C_NULL_FUNPTR, c_loc(val))

These should get rejected, too.  Can you see how to catch these, too?

Thanks,
Harald

Yes, will do! I try to think of cases to run through on. This helps.

Thanks,

Jerry
--- snip ---

Will this was easy. I added those two lines to my current test2.f90 and they are rejected. I will update the testcase in the ready to commit copy.

OK to push then?

$ gfc test2.f90
test2.f90:46:36:

   46 |   print *, c_associated(c_loc(val), C_NULL_FUNPTR)
      |                                    1
Error: Argument C_PTR_2 at (1) to C_ASSOCIATED shall have the same type as C_PTR_1: TYPE(c_ptr) instead of TYPE(c_funptr)
test2.f90:47:39:

   47 |   print *, c_associated(C_NULL_FUNPTR, c_loc(val))
      |                                       1
Error: Argument C_PTR_2 at (1) to C_ASSOCIATED shall have the same type as C_PTR_1: TYPE(c_funptr) instead of TYPE(c_ptr)

Reply via email to