Hi Jerry,

This looks good to me, with a couple of wee grumbles:

(1) +      /* Same fix-up, for the finalizer wrapper symbol.  */
These chunks are 346 lines apart. Entropy will not be increased by
repeating the first comment.

(2) s/CONTAINS'ed/contained/ :-)

(3) Finally, since PR125051, which uncovered this one, was backported,
surely this patch should be backported too?

OK for mainline and backporting.

Thanks for the patch.

Paul

On Fri, 10 Jul 2026 at 04:26, Jerry D <[email protected]> wrote:
>
> I all, the attached patch regression tested on x86_64
>
> I have not used the gfortran.dg/lto/ testsuite things so it took me a while to
> come up with the test cases. Both are based on Andrew's original examples
> provided in the PR.
>
> OK for mainline?
>
> I don't think we need to backport this. Let me know otherwise.
>
> Regards,
>
> Jerry
> ---
> fortran: [PR126170] Fix LTO ICE in copy_function_or_variable
>
>      A redundant USE of a module already visible via host association,
>      written inside a contained procedure, caused gfortran's module
>      reader to create a second copy of that module's derived
>      type.
>
>      PR fortran/126170
>
>      gcc/fortran/ChangeLog:
>
>              PR fortran/126170
>              * class.cc (gfc_find_derived_vtab): Fix up a stale
>              non-use-associated duplicate vtab symbol.
>              (gfc_is_finalizable): Same fix-up, for the finalizer wrapper
>              symbol.
>              * module.cc (read_module): Skip re-importing a symbol already
>              visible via host association from the same module.
>
>      gcc/testsuite/ChangeLog:
>
>              PR fortran/126170
>              * gfortran.dg/lto/pr126170_0.f90: New test.
>              * gfortran.dg/lto/pr126170_1.f90: New test.
> ---

Reply via email to