diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 554e664100cf410983784a0a1b6618d80264c7b4..8460c75ae219b5ec0a7777e74313c0c4d76af7d9 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2008-04-03  Dominique d'Humieres <dominiq@lps.ens.fr>
+
+	PR target/35801
+	* config/rs6000/rs6000.c (rs6000_output_mi_thunk): Free cfun.
+
 2008-04-03  Ben Elliston  <bje@au.ibm.com>
 
 	* expmed.c (extract_split_bit_field): Remove if (0) code.
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index c8ebd7fb8a47732d36a0fe44644ae1e7a9a8ec36..4588a14d274538cfa5147c2845ab19b7eabf9a20 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -17124,6 +17124,7 @@ rs6000_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
   final_start_function (insn, file, 1);
   final (insn, file, 1);
   final_end_function ();
+  free_after_compilation (cfun);
 
   reload_completed = 0;
   epilogue_completed = 0;