]> git.ipfire.org Git - thirdparty/gcc.git/commit
Fortran: Set the vptr of a class typed result.
authorAndre Vehreschild <vehre@gcc.gnu.org>
Thu, 6 Jun 2024 12:01:13 +0000 (14:01 +0200)
committerAndre Vehreschild <vehre@gcc.gnu.org>
Wed, 19 Jun 2024 08:39:56 +0000 (10:39 +0200)
commitdbb718175d7df89b957b316ba2f5fbea5d21b2b1
tree9ced42911ff7d3df14030a26945dc925b47dcbf8
parent23141088e8fb50bf916ac0b2e364b1eef9f3569d
Fortran: Set the vptr of a class typed result.

PR fortran/90076

gcc/fortran/ChangeLog:

* trans-decl.cc (gfc_generate_function_code): Set vptr for
results to declared class type.
* trans-expr.cc (gfc_reset_vptr): Allow to provide the typespec
instead of the expression.
* trans.h (gfc_reset_vptr): Same.

gcc/testsuite/ChangeLog:

* gfortran.dg/class_76.f90: Add declared vtab occurrence.
* gfortran.dg/class_78.f90: New test.
gcc/fortran/trans-decl.cc
gcc/fortran/trans-expr.cc
gcc/fortran/trans.h
gcc/testsuite/gfortran.dg/class_76.f90
gcc/testsuite/gfortran.dg/class_78.f90 [new file with mode: 0644]