Summary: | [OOP] Allocation of a CLASS with SOURCE=<class> does not work | ||
---|---|---|---|
Product: | gcc | Reporter: | Tobias Burnus <burnus> |
Component: | fortran | Assignee: | janus |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | gcc-bugs, janus |
Priority: | P3 | Keywords: | wrong-code |
Version: | 4.5.0 | ||
Target Milestone: | 4.5.0 | ||
Host: | Target: | ||
Build: | Known to work: | ||
Known to fail: | Last reconfirmed: | 2009-10-11 19:07:13 |
Description
Tobias Burnus
2009-10-05 12:52:36 UTC
To prevent wrong-code, SOURCE=<class> is now rejected (cf. PR 41582). For the run-time version: One might also need to check whether SOURCE is allocated - at least with some checking option. Mine. The plan: Add a '$size' field to the class container, which will be used at runtime to determine the size of the memory block to be allocated. Subject: Bug 41581 Author: janus Date: Tue Oct 13 16:12:24 2009 New Revision: 152715 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=152715 Log: 2009-10-13 Janus Weil <janus@gcc.gnu.org> PR fortran/41581 * decl.c (encapsulate_class_symbol): Add new component '$size'. * resolve.c (resolve_allocate_expr): Move CLASS handling to gfc_trans_allocate. (resolve_class_assign): Replaced by gfc_trans_class_assign. (resolve_code): Remove calls to resolve_class_assign. * trans.c (gfc_trans_code): Use new function gfc_trans_class_assign. * trans-expr.c (get_proc_ptr_comp): Fix a memory leak. (gfc_conv_procedure_call): For CLASS dummies, set the $size component. (gfc_trans_class_assign): New function, replacing resolve_class_assign. * trans-stmt.h (gfc_trans_class_assign): New prototype. * trans-stmt.c (gfc_trans_allocate): Use correct size when allocating CLASS variables. Do proper initialization. Move some code here from resolve_allocate_expr. 2009-10-13 Janus Weil <janus@gcc.gnu.org> PR fortran/41581 * gfortran.dg/class_allocate_2.f03: Modified. * gfortran.dg/class_allocate_3.f03: New test case. Added: trunk/gcc/testsuite/gfortran.dg/class_allocate_3.f03 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/decl.c trunk/gcc/fortran/resolve.c trunk/gcc/fortran/trans-expr.c trunk/gcc/fortran/trans-stmt.c trunk/gcc/fortran/trans-stmt.h trunk/gcc/fortran/trans.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/gfortran.dg/class_allocate_2.f03 |