This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch, fortran] PR 82312 - [7/8 Regression] Pointer assignment to component of class variable results wrong vptr for the variable


Greetings to all,

This patch fixes a bug where the pointer assignment to the derived
component of a class entity was resulting in the base entity's vptr
being set to the vtable of the target. This resulted in the wrong
typebound procedure being called.

The patch corrects the logic in resolve code that determines when
regular assignment is used for class pointer assignment and breaks out
some codeto handle function targets from trans_pointer_assignment so
that function targets are correctly handled.

Bootstraps and regtests on FC23/x86_64 - OK for trunk and 7 branch?

Cheers

Paul

2017-09-30  Paul Thomas  <pault@gcc.gnu.org>

    PR fortran/82312
    * resolve.c (gfc_resolve_code): Simplify condition for class
    pointer assignments becoming regular assignments by asserting
    that only class valued targets are permitted.
    * trans-expr.c (trans_class_pointer_fcn): New function using a
    block of code from gfc_trans_pointer_assignment.
    (gfc_trans_pointer_assignment): Call the new function. Tidy up
    a minor whitespace issue.

2017-09-30  Paul Thomas  <pault@gcc.gnu.org>

    PR fortran/82312
    * gfortran.dg/typebound_proc_36.f90 : New test.

Attachment: submit.diff
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]