aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-array.c
diff options
context:
space:
mode:
authorAndre Vehreschild <vehre@gcc.gnu.org>2017-02-05 13:02:15 +0100
committerAndre Vehreschild <vehre@gcc.gnu.org>2017-02-05 13:02:15 +0100
commit4b9c80d8e4a1d14f6e517aac2267675910488510 (patch)
treeb43150a91f131b9ad4db6dd0d773f5cca7aa23a9 /gcc/fortran/trans-array.c
parent3501e62c3ae88066fb40f9c1360c2ee9fb716b12 (diff)
downloadgcc-4b9c80d8e4a1d14f6e517aac2267675910488510.zip
gcc-4b9c80d8e4a1d14f6e517aac2267675910488510.tar.gz
gcc-4b9c80d8e4a1d14f6e517aac2267675910488510.tar.bz2
re PR fortran/79230 ([OOP] Run time error: double free or corruption)
gcc/fortran/ChangeLog: 2017-02-05 Andre Vehreschild <vehre@gcc.gnu.org> PR fortran/79230 * trans-array.c (structure_alloc_comps): Ignore pointer components when freeing structures. gcc/testsuite/ChangeLog: 2017-02-05 Andre Vehreschild <vehre@gcc.gnu.org> PR fortran/79230 * gfortran.dg/der_ptr_component_2.f90: New test. From-SVN: r245191
Diffstat (limited to 'gcc/fortran/trans-array.c')
-rw-r--r--gcc/fortran/trans-array.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c
index a3aab8e..d0dfc26 100644
--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -8220,9 +8220,17 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl,
/* Shortcut to get the attributes of the component. */
if (c->ts.type == BT_CLASS)
- attr = &CLASS_DATA (c)->attr;
+ {
+ attr = &CLASS_DATA (c)->attr;
+ if (attr->class_pointer)
+ continue;
+ }
else
- attr = &c->attr;
+ {
+ attr = &c->attr;
+ if (attr->pointer)
+ continue;
+ }
if ((c->ts.type == BT_DERIVED && !c->attr.pointer)
|| (c->ts.type == BT_CLASS && !CLASS_DATA (c)->attr.class_pointer))