aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorHarald Anlauf <anlauf@gmx.de>2024-01-03 20:21:00 +0100
committerHarald Anlauf <anlauf@gmx.de>2024-01-03 20:21:00 +0100
commit93c96e3ad0024a397115aa17bf29c7efc6b535a1 (patch)
tree22a5388f21b228dffa50c207120545ee13551970 /gcc
parenta56a693a74dd3bee71b1266b09dbd753694ace94 (diff)
downloadgcc-93c96e3ad0024a397115aa17bf29c7efc6b535a1.zip
gcc-93c96e3ad0024a397115aa17bf29c7efc6b535a1.tar.gz
gcc-93c96e3ad0024a397115aa17bf29c7efc6b535a1.tar.bz2
Fortran: fix FE memleak
gcc/fortran/ChangeLog: * trans-types.cc (gfc_get_nodesc_array_type): Clear used gmp variables.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fortran/trans-types.cc12
1 files changed, 7 insertions, 5 deletions
diff --git a/gcc/fortran/trans-types.cc b/gcc/fortran/trans-types.cc
index e6db1c9..676014e 100644
--- a/gcc/fortran/trans-types.cc
+++ b/gcc/fortran/trans-types.cc
@@ -1795,7 +1795,7 @@ gfc_get_nodesc_array_type (tree etype, gfc_array_spec * as, gfc_packed packed,
TYPE_LANG_SPECIFIC (type) = TYPE_LANG_SPECIFIC (TREE_TYPE (type));
}
- return type;
+ goto array_type_done;
}
if (known_stride)
@@ -1814,10 +1814,6 @@ gfc_get_nodesc_array_type (tree etype, gfc_array_spec * as, gfc_packed packed,
layout_type (type);
- mpz_clear (offset);
- mpz_clear (stride);
- mpz_clear (delta);
-
/* Represent packed arrays as multi-dimensional if they have rank >
1 and with proper bounds, instead of flat arrays. This makes for
better debug info. */
@@ -1848,6 +1844,12 @@ gfc_get_nodesc_array_type (tree etype, gfc_array_spec * as, gfc_packed packed,
GFC_ARRAY_TYPE_P (type) = 1;
TYPE_LANG_SPECIFIC (type) = TYPE_LANG_SPECIFIC (TREE_TYPE (type));
}
+
+array_type_done:
+ mpz_clear (offset);
+ mpz_clear (stride);
+ mpz_clear (delta);
+
return type;
}