Ping

On 11/7/26 10:48 AM, Jerry D wrote:
On 11/6/26 3:12 PM, Jerry D wrote:
The following attached patch regression tested on x86_64 and arm.

OK for mainline?

Regards,

Jerry


I did some additional checking while working on another PR and discovered I missed a dependency.  Attached here is a v2 of the patch which now includes its own CLASS copy helper and no longer depends on PR51284 or PR128017-3 which I am working on.

Regression tested on x86_64.

Ok for mainline?

Jerry


---

[PATCH] fortran: [PR128478] Copy a parenthesized scalar CLASS actual argument

A parenthesized scalar CLASS variable passed as an actual argument was
not copied, so the dummy aliased the variable, and passing it to a TYPE
dummy with allocatable components segfaulted, because the components of
the CLASS container were copied and freed as if it were the derived
type.  Make the value of a parenthesized scalar CLASS variable a copy in
gfc_conv_expr_op, which also serves the ASSOCIATE selector, keep the
free of the copy until after the call, and leave its components to the
copy's own finalization.

Assisted-by: Claude Opus 5.5

     PR fortran/128478

gcc/fortran/ChangeLog:

     * trans-expr.cc (gfc_conv_expr_op): Copy a parenthesized scalar
     CLASS variable.
     (gfc_conv_procedure_call): Do not copy or free the allocatable
     components of the copy of a parenthesized scalar CLASS variable.
     (gfc_conv_expr_reference): Keep the free of that copy in se->post.
     * trans-stmt.cc (trans_associate_var): Remove the copy of a
     parenthesized CLASS selector, now done by gfc_conv_expr_op.

gcc/testsuite/ChangeLog:

     * gfortran.dg/asan/paren_class_copy_1.f90: New test.
---

Reply via email to