aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2001-01-09 01:08:53 +0000
committerNick Clifton <nickc@gcc.gnu.org>2001-01-09 01:08:53 +0000
commitf7a80099bdb0a835a35df02093e2f52420d2cfcd (patch)
tree32c3f4d5fdd861f2938392c6fc1f674a05442cfa /gcc
parent5a259aec511b294d3be1df9d54a3bebf8ad89c7c (diff)
downloadgcc-f7a80099bdb0a835a35df02093e2f52420d2cfcd.zip
gcc-f7a80099bdb0a835a35df02093e2f52420d2cfcd.tar.gz
gcc-f7a80099bdb0a835a35df02093e2f52420d2cfcd.tar.bz2
Fix memory leak
From-SVN: r38811
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/config/arm/arm.c20
2 files changed, 25 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 4e28f23..45338c3 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2001-01-08 Nick Clifton <nickc@redhat.com>
+
+ * config/arm/arm.c (arm_mark_machine_status): Check to see if
+ the machine structure has been allocated.
+ (arm_free_machine_status): New function: Free the machine
+ specific function structure.
+
2001-01-08 Richard Henderson <rth@redhat.com>
* jump.c (simplejump_p): Revert last change.
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 5401773..4a34369 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -76,6 +76,7 @@ static Mmode select_dominance_cc_mode PARAMS ((rtx, rtx, Hint));
static Ccstar shift_op PARAMS ((rtx, Hint *));
static void arm_init_machine_status PARAMS ((struct function *));
static void arm_mark_machine_status PARAMS ((struct function *));
+static void arm_free_machine_status PARAMS ((struct function *));
static int number_of_first_bit_set PARAMS ((int));
static void replace_symbols_in_block PARAMS ((tree, rtx, rtx));
static void thumb_exit PARAMS ((FILE *, int, rtx));
@@ -9587,8 +9588,11 @@ arm_mark_machine_status (p)
{
machine_function *machine = p->machine;
- ggc_mark_rtx (machine->ra_rtx);
- ggc_mark_rtx (machine->eh_epilogue_sp_ofs);
+ if (machine)
+ {
+ ggc_mark_rtx (machine->ra_rtx);
+ ggc_mark_rtx (machine->eh_epilogue_sp_ofs);
+ }
}
static void
@@ -9603,6 +9607,17 @@ arm_init_machine_status (p)
#endif
}
+static void
+arm_free_machine_status (p)
+ struct function * p;
+{
+ if (p->machine)
+ {
+ free (p->machine);
+ p->machine = NULL;
+ }
+}
+
/* Return an RTX indicating where the return address to the
calling function can be found. */
rtx
@@ -9650,6 +9665,7 @@ arm_init_expanders ()
/* Arrange to initialize and mark the machine per-function status. */
init_machine_status = arm_init_machine_status;
mark_machine_status = arm_mark_machine_status;
+ free_machine_status = arm_free_machine_status;
}
/* Generate the rest of a function's prologue. */