On Mon, May 05, 2025 at 08:30:09PM -0700, Jerry D wrote: > Attached patch fixes this by checking for BT_VOID and EXPR_FUNCTION. > > Thank you for guidance from Steve in the PR and Vincent for > identifying the problem. > > Two test case files added to the testsuite. > > Regression tested on x86_64. > > OK for mainline? >
I see Paul has already given you the ok, which is fine with me. One small nit below. > @@ -5955,30 +5955,40 @@ gfc_check_c_sizeof (gfc_expr *arg) > bool > gfc_check_c_associated (gfc_expr *c_ptr_1, gfc_expr *c_ptr_2) > { > - if (c_ptr_1->ts.type != BT_DERIVED > - || c_ptr_1->ts.u.derived->from_intmod != INTMOD_ISO_C_BINDING > - || (c_ptr_1->ts.u.derived->intmod_sym_id != ISOCBINDING_PTR > - && c_ptr_1->ts.u.derived->intmod_sym_id != ISOCBINDING_FUNPTR)) > + if (c_ptr_1) This test is not needed. c_ptr_1 is an required argument to c_associated() and is guaranteed to be non-NULL at this point. > { <Deleted patch> > } > > + if (c_ptr_2) This test is needed because c_ptr_2 is an optional argument. If it is not present, it is guaranteed to be NULL. -- Steve