Hi Kirill,

On 2/2/26 16:05, Kirill Chilikin wrote:

Dear maintainers,

The attached patch fixes PR 117303. The reference returned by C_FUNLOC
is assigned to a variable in the added code. Without that,
no reference from the calling subprogram to the argument of C_FUNLOC
was created in the call graph, resulting in an undefined-reference error
with link-time optimization.

The patch was tested using with "check-fortran" on a x86_64-pc-linux-gnu
system. One existing test from gfortran.dg/c_funloc_test_7.f90 failed
as expected due to code-generation change. The generated code was

    cfp = (void (*<T6d>) (void)) nocsub;

but now it became

      void * D.4685;
      D.4685 = (void *) nocsub;
      cfp = (void (*<T6f>) (void)) D.4685;

The test has been modified in accordance with the changes.
Another test, gfortran.dg/c_funloc_test_9.f90, has been converted from
the test case in PR.

     PR fortran/117303

gcc/fortran/ChangeLog:

     * trans-intrinsic.cc (conv_isocbinding_function):
          Assign the reference returned by C_FUNLOC to a variable.

gcc/testsuite/ChangeLog:

     * gfortran.dg/c_funloc_tests_7.f90:
          Updated test due to changed code generation.
     * gfortran.dg/c_funloc_tests_9.f90: New test.

Signed-off-by: Kirill Chilikin <[email protected]>
---

Please see the attached file for the actual patch.
If accepted, please commit the change as I do not have write access.

Regards,
Kirill

this looks good to me, but I will leave 24 h for others to have a
look or comment on it, as I am not too familiar with LTO subtleties.
Will commit then unless someone else beats me to it.

Thanks,
Harald

Reply via email to