From c7ac4fb53d99bc86133fec643cf010685623382c Mon Sep 17 00:00:00 2001
From: Nick Clifton <nickc@redhat.com>
Date: Tue, 29 Sep 2009 09:31:41 +0000
Subject: [PATCH] function.c (current_function_name): If there is no current
 function just return "<none>".

        * function.c (current_function_name): If there is no current
        function just return "<none>".

From-SVN: r152269
---
 gcc/ChangeLog  | 5 +++++
 gcc/function.c | 2 ++
 2 files changed, 7 insertions(+)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 9826735864cc..7ab49af44b07 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2009-09-29  Nick Clifton  <nickc@redhat.com>
+
+	* function.c (current_function_name): If there is no current
+	function just return "<none>".
+
 2009-09-28  Sriraman Tallam  <tmsriram@google.com>
 
 	* tree-pass.h (register_pass_info): New structure.	
diff --git a/gcc/function.c b/gcc/function.c
index aaed57a5de1b..35c0cfd609e8 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -5415,6 +5415,8 @@ reposition_prologue_and_epilogue_notes (void)
 const char *
 current_function_name (void)
 {
+  if (cfun == NULL)
+    return "<none>";
   return lang_hooks.decl_printable_name (cfun->decl, 2);
 }